How can we help?

Using Auron SMS Component in PowerShell

The SMS Component is ready to be used in Powershell without any extra configuration steps.

The example script below sends an SMS messages from a GSM modem using the SMS Component API in PowerShell.

You can find more working examples of how to use the Auron SMS Component in Powershell on github.

To run this script just copy and past it into notepad and save it as ‘sendfromgsm.ps1‘.

Open up a PowerShell prompt. Navigate to the directory where the script was saved. Run the script in PowerShell using the command: ‘.\sendfromgsm.ps1

$objGsm = new-object -comobject AxSms.Gsm
$objSmsMessage = new-object -comobject AxSms.Message

# Display SMS Component Version
write-host Auron SMS Component $objGsm.Version
write-host Build: $objGsm.Build `nModule: $objGsm.Module

# Open connection to the device
write-host Open, result: $objGsm.LastError `
If ($objGsm.LastError -ne 0)
  write-host Ready.

# Message: set all properties
$objSmsMessage.ToAddress       = "+3162312345678"
$objSmsMessage.Body            = "Just testing the Auron Software SMS Component"

# Send the Message
write-host Sending the Message...
write-host SendSms, result: $objGsm.LastError `
write-host Message Reference (can be used with status reports): $objSmsMessage.Reference

write-host Ready.