PoshCode Archive  Check-in [277b19502e]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:http://en.wikipedia.org/wiki/List_of_SMS_gateways
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:277b19502ee99ad823fc54c9018b5dc28857e16cb351229ee418f5b5f4a643dd
User & Date: dvsbobloblaw 2018-06-10 14:16:28
Context
2018-06-10
14:16
Returns the priority mail server (SMTP) to send email directly to the SMTP server of a particular domain/email address. Uses NetCmdlets (get-dns). check-in: 7477bcba4c user: Lance Robinson tags: trunk
14:16
http://en.wikipedia.org/wiki/List_of_SMS_gateways check-in: 277b19502e user: dvsbobloblaw tags: trunk
14:16
Re\sets password for specified user. Original https://github.com/gregzakh/alt-ps/blob/master/New-Password.ps1 check-in: 59c121aacf user: Hacker tags: trunk
Changes

Added werwerwer.ps1.









































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# encoding: ascii
# api: powershell
# title: werwerwer
# description: http://en.wikipedia.org/wiki/List_of_SMS_gateways
# version: 0.1
# type: script
# author: dvsbobloblaw
# license: CC0
# x-poshcode-id: 6471
# x-archived: 2016-08-13T22:13:07
# x-published: 2016-08-12T09:59:00
#
# You can send text messages with send-mailmessage. Really easy. I attempted to do something with it, not sure what though.
#
<#
.SYNOPSIS
An attempt to send text messages to phones. 

.DESCRIPTION
Have you ever wrote a deamon script that notifies you when a server is down or something else. Wouldn't it be nice to get a TEXT (SMS) message.

.EXAMPLE 
Send-TextMessage -Port 587 -SmtpServer 'smtp.gmail.com' -UseSsl -Body 'Hello World' -From 'evilperson@gmail.com' -Subject '>=)' -Number '7238675309' -ServiceProvider Verizon -Credential (Get-Credential)

This will send a text message to 7238675309 from evilperson@gmail.com

.NOTES
This is pretty lame if you already know the person's text email address gateway thing.
#>


[CmdletBinding(HelpUri='http://go.microsoft.com/fwlink/?LinkID=135256')]
param(

    #Specifies the body (content) of the text message.
    [Parameter(Mandatory=$true)]
    [Alias('Message')]
    [ValidateNotNullOrEmpty()]
    [ValidateLength(1,159)]
    [string]$Body,

    #Specifies the address from which the message is sent.
    [Parameter(Mandatory=$true)]
    [ValidateNotNullOrEmpty()]
    [string]$From,

    #Specifies the name of the SMTP server that sends the text message.
    [Parameter()]
    [Alias('ComputerName')]
    [ValidateNotNullOrEmpty()]
    [string]$SmtpServer,

    #Specifies the subject of the text message. This parameter is required.
    [Parameter(Mandatory=$true)]
    [Alias('sub')]
    [ValidateNotNullOrEmpty()]
    [string]$Subject,

    #Specifies the phone number to which the text message is sent.
    [Parameter(Mandatory=$true)]
    [Alias('To','PhoneNumber')]
    [ValidateNotNullOrEmpty()]
    [string]$Number,

    #Specifies a user account that has permission to perform this action. The default is the current user.
    [ValidateNotNullOrEmpty()]
    [pscredential]$Credential,

    #Uses the Secure Sockets Layer (SSL) protocol to establish a connection to the remote computer to send mail. By default, SSL is not used.
    [switch]$UseSsl,

    #Specifies an alternate port on the SMTP server.
    [ValidateRange(0, 2147483647)]
    [int]$Port,

    #Carriers providing Short Message Service (SMS) transit via SMS gateways.
    [Parameter(Mandatory=$true)]
    [ValidateSet('USCellular','Verizon','ATT','Sprint','Virgin','T-Mobile','Cricket')]
    [string]$ServiceProvider
)

switch ($ServiceProvider) {
    'USCellular' {$Recipient="$Number@email.uscc.net"}
    'Verizon' {$Recipient="$Number@vtext.com"}
    'ATT' {$Recipient="$Number@vmobl.com"}
    'Sprint' {$Recipient="$Number@messaging.sprintpcs.com"}
    'Virgin' {$Recipient="$Number@vmobl.com"}
    'T-Mobile' {$Recipient="$Number@tmomail.net"}
    'Cricket' {$Recipient="$Number@sms.mycricket.com"}
    default {throw 'How did this happen?'}
}

$Information = @{Body=$Body;From=$From;SmtpServer=$SmtpServer;Subject=$Subject;To=$Recipient;Credential=$Credential;UseSsl=$UseSsl;Port=$Port}

try{
    Send-MailMessage @Information
}
catch{
    throw "Awe, it didn't work."
}