• Send SMS through bibob with Powershell

    I thought I had posted this script more than a year ago, but apparently I have not. It is quite similar to the script, I posted recently sending SMS messages through unwire, this just allows bibob customers to send messages through bibobs online gateway.

    One thing to notice is that you are required to convert your password in an MD5 hash, before you send it. Here is a function to convert your plain passwords into an MD5 hash (Adapted from a script by Dennis Damen)

    Function New-MD5Hash {
    [Parameter(Position=0, Mandatory=$true)]
    $cryptoServiceProvider = [System.Security.Cryptography.MD5CryptoServiceProvider];
    $hashAlgorithm = new-object $cryptoServiceProvider
    $hashByteArray = $hashAlgorithm.ComputeHash($([Char[]]$inputString));
    foreach ($byte in $hashByteArray) { if ($byte -lt 16) {$result += “0{0:X}” -f $byte } else { $result += “{0:X}” -f $byte }}
    write-host $result
    Example of usage:

    Here is the bibob send sms script.
    Send SMS through Bibob (Danish mobile phone company)

    Send SMS Text messages through bibob SMS Gateway services

    .PARAMETER Content
    The text that the message should contain (Strings above 160 Chars will be split) [Mandatory]

    .PARAMETER Recipient
    The recipient phonenumber (8 digits) [Mandatory]

    PS C:\>Send-SMS -Content "Hello handsome" -Recipient 42424242


    Sends SMS text message





    function Send-SMS {
    [Parameter(Position=0, Mandatory=$true)]
    $Content= "Hello Handsome",
    begin {
    If ($Recipient -notmatch ‘^(\d{8})$’ )
    {Write-Host "Error in Phone Number"
    $Username = "42424242" # The same as your login to bibob.dk (You cannot spoof you sender number, so it is used as sender as well)
    $MD5Password = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"


    process {
    $objHTTP = New-Object -ComObject MSXML2.XMLHTTP
    $SoapServer = "https://www.bibob.dk/SmsSender.asmx"

    $XMLString = @"
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <SendMessage xmlns="http://www.bibob.dk/">

    $objHTTP.open(‘POST’, $SoapServer, $False)

    $objHTTP.setRequestHeader(‘Man’, ‘POST’ + ‘ ‘ + $SoapServer + ‘ HTTP/1.1′)
    $objHTTP.setRequestHeader(‘Host’, ‘www.bibob.dk’)
    $objHTTP.setRequestHeader(‘Content-Type’, ‘text/xml; charset=utf-8′)
    $objHTTP.setRequestHeader(‘Content-Length’, $($XMLString.Length))
    $objHTTP.setRequestHeader(‘SOAPAction’, ‘http://www.bibob.dk/SendMessage’)