ℹ️ The Auron SMS Server is now Auron Omni. Learn more here.

How can we help?

Send and receive using PowerShell


You can use PowerShell to send and receive SMS messages with Auron Omni.

All that is required is the Auron Omni API to create a new message in the Auron Omni database. The Auron Omni service picks up the message and sends it automatically at the scheduled time.

For example, to send an SMS message you can use this script:

# Create global objects
$objMessageDB = new-object -comobject AxMmServer.MessageDB
$objConstants = new-object -comobject AxMmServer.Constants

write-host "API Module: " $objMessageDB.Module
write-host "API Version: " $objMessageDB.Build

# Create a new message object
$objMessage = $objMessageDB.Create("SMS")

$objMessage.DirectionID  = $objConstants.MESSAGEDIRECTION_OUT
$objMessage.ChannelID    = ""  # First available SMS channel
$objMessage.ScheduledTime = Get-Date # To indicate immediate schedule. 
# To schedule 1 day and 2 hours in advance, specify ((Get-Date).AddDays(1)).AddHours(2)
# To schedule on a specific date and time, specify "12/25/2005 07:30"

$objMessage.ToAddress    = "31623123456"
$objMessage.Body         = "This is an Auron Omni test message"

# Save the new values that were just assigned
$objMessageDB.Save($objMessage)
write-host "Save result: " $objMessageDB.LastError " (" `
  $objMessageDB.GetErrorDescription($objMessageDB.LastError) ")"

write-host "Ready."

To list the 10 most recently received messages, you can run this script:

# Create global objects
$objMessageDB = new-object -comobject AxMmServer.MessageDB

write-host "API Module: " $objMessageDB.Module
write-host "API Version: " $objMessageDB.Build

# Find and iterate over messages
$objMessage = $objMessageDB.FindFirstMessage("SMS", "", "ID DESC", 10) 
while ($objMessageDB.LastError -eq 0)
{
  write-host "Message #" $objMessage.ID
  write-host "  StatusID: " $objMessage.StatusID " (" `
    $objMessageDB.GetStatusDescription($objMessage.StatusID) ")"
  write-host "  ChannelID: " $objMessage.ChannelID
  write-host "  Body: " $objMessage.Body 

  $objMessage = $objMessageDB.FindNextMessage()
}

write-host "Ready."