Send Text Message Free Mobile PowerShell
In France, we have a mobile phone provider named “Free Mobile”. They expose an API for each subscriber to allow us to send text message to our-selves.This feature is free of charge so you can use it quite a lot without any down side. This can be useful many cases:
- Alert when a script end
- Alert when a script fail
- Alert on an event (attach task to this event)
- Alert on condition inside a script (e.g. drive failure)
The API is exposed here:
You need 3 parameters to use it:
The first one is your UserID composed of 8 digits, the password associated with it is a special one (different from the one of your account) that can be found on your personal information in your Free Mobile account. The last one is the text you want to send in the text.
Hereunder an example:
$User = '12345678' $Pass = '1234567890' $Text = 'This is a test from PowerShell !' -replace ' ','%20' $FreeUrl = "https://smsapi.free-mobile.fr/sendmsg?user=$User&pass=$Pass&msg=$Text" Invoke-WebRequest -Uri $FreeUrl
Note: You need to replace each space (‘ ‘) in your sentence with ‘%20’ for encoding purpose.
And now, let’s have a look at my phone:
The text is here!