Send text messages (SMS) using Windows PowerShell
In Microsoft Office Outlook there is an add-in called Microsoft Outlook SMS Add-in (MOSA), which provides the ability to send text messages (SMS). MOSA is builtin to Outlook 2010, and are available as a plugin for Outlook 2003 and 2007 here.
On the Microsoft Office Online Help you can find guidance on how to set up the service account and sending a text message. To find the necessary settings for your mobile service provider, go here.
I looked into the COM-object for Outlook, and it turned out to be rather easy to use this API to send text messages from MOSA.
Based on that I created an Advanced function in Windows PowerShell v2 called Send-SMSMessage.
To define the function you can either paste it directly into your session, save it as a ps1 script-file and dot source it, put it into your profile or into a module.
When that is accomplished you can find usage information using the consistent Get-Help cmdlet:
Sample usage:
The function checks if Outlook are installed, and breaks out with a warning if not:
It also checks to see if an account are configured for Text Messaging (SMS):
Any errors related to service availabilty, correct phonenumber format and so on are handled by the SMS Add-in itself. These error messages appear in the Outlook inbox:
The function is tested from Outlook 2010 only, but should work from 2003 and 2007 also when MOSA is installed.
Since the function accepts ValueFromPipeline and ValueFromPipelineByPropertyName you can use it in conjunction with e.g. the Active Directory cmdlets for Windows PowerShell. A given example of this retrieves all users from Active Directory with a derfined mobilephone number and sends them an SMS with their username:
Another practical usage scenario I can think of is combining the Send-SMSMessage function with user provisioning, sending the new user it`s new username and password.
Feel free to come up with more usage scenarios in the comment field below.
Bonus tips
- You can also send MMS messages using the Outlook COM-object. To do this, use “olMobileItemMMS” instead of “olMobileItemSMS” in the following line: $NewMessage = $outlook.CreateItem(“olMobileItemMMS”). You should also look into the other properties for MMS messages, like the Attachment-property.
- If you got more than one account configured for text messaging, you can use the SendUsingAccount-property to define which account to send from.
- If you use the Norwegian mobile service provider Telenor, the “Service Provider URL” in the account settings is https://telenormobil.no/smapi/services/omsv3_service
July 21, 2010 Posted by Jan Egil Ring | Active Directory management, Microsoft Outlook, Scripting, Windows PowerShell | powershell send sms, powershell send text message, sms from powershell | 10 Comments
About
My name is Jan Egil Ring and I live in Oslo, Norway. I work as a Senior Consultant on the Infrastructure Team at Crayon Norway.
I`m holding different certifications such as MCITP: Enterprise Messaging Administrator and MCITP: Enterprise Administrator. For more details see my MCP Virtual Business Card.
I work mainly with Microsoft-products, and my favourite server product is Microsoft Exchange.
I`m a co-founder of the Norwegian Microsoft Technology User Group (MTUG), which is an assosication of local MTUG user groups in Norway.
I`m also a big fan of Windows PowerShell as you probably guessed based on the blog-title
My intentions with this blog are sharing my experiences based on various projects and troubleshooting, as well as sharing different resource links to technologies I work with.
RSS-feed
Blogroll
Google Reader – My Shared Items- Creating and Comparing Configuration Baselines Don Jones
- Designing Cmdlets That Have Lots of Parameters PowerShellTeam
- Automated physical-to-virtual migration for Windows 7 Graham Watkins
- Quick Tip: Add Exchange Management Shell Menu Item in PowerShell ISE Mike Pfeiffer
- Exchange 2007/2010 Connection Filtering and Transport Configuration Elan Shudnow
Category Cloud
Active Directory management Deployment Exchange 2003 Exchange ActiveSync Exchange Server 2007 Exchange Server 2010 Exchange Server management File system General Group Policy IIS MDT 2010 Microsoft Outlook Migration Print management Remote Desktop Services SBS 2008 Scripting SQL Server Terminal Services Uncategorized Usergroups Virtualization Windows 7 Windows PowerShell Windows Server 2003 R2 Windows Server 2008 Windows Server 2008 R2 Windows Vista Windows XP
-
Top Posts
My tweets
- GeekBeer og KickOff for TechNet Live med Johan Arwidmark (MVP) http://bit.ly/bgDFSe #mtug #technetlive 10 hours ago
- I just set my background to 50 supporters of PowerShell rocks! you can too: http://twb.ly/7SLlYz 15 hours ago
- Norway 1 - 0 Portugal Full time :-D 2 days ago
- Anyone knows when the Outlook 2007 update that enables the viewing of online archive mailboxes will be available? http://bit.ly/a2ATPl 3 days ago
- The only valid measurement of code quality: http://bit.ly/ebszS 3 days ago
Personal links
-
Blog Stats
- 60,150 hits