Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124


In today’s digital age, effective communication is crucial for both personal and professional success. One powerful tool for achieving this is SMS messaging, which allows for quick and direct communication. In this guide, “How to Send SMS Using PowerShell”, I will walk you through the process of leveraging PowerShell and Twilio to send SMS messages efficiently. Whether you’re a seasoned developer or just starting out, this guide will provide you with the knowledge and tools you need to integrate SMS functionality into your applications seamlessly.
Twilio is paid Solution, but you can start with trial account :

After creating your trial account, you’ll get this information :

Now, we will complete PowerShell Script with these 3 informations.
Replice 5 first variables with your own values ($accountSid, $authToken, $from, $to, $body) :
# Twilio login information to change
$accountSid = "AC1c778396c23eab91cb921324156465465"
$authToken = "6142fad94654sd654f6sda34198b2cb4d"
$from = "+12189934936" # Twilio Number
$to = "+15141112233" # destination Number
$body = "Hi Aymen , This is a Message sent via PowerShell !"
# Create query object
$uri = "https://api.twilio.com/2010-04-01/Accounts/$accountSid/Messages.json"
$bodyData = @{
To = $to
From = $from
Body = $body
}
# Send via Invoke-RestMethod
$response = Invoke-RestMethod -Uri $uri -Method Post -Body $bodyData -Credential (New-Object System.Management.Automation.PSCredential($accountSid, (ConvertTo-SecureString $authToken -AsPlainText -Force)))
# Show answer
$response.sid

By following the steps outlined in this guide, you will be able to harness the power of PowerShell and Twilio to send SMS messages with ease. This capability can enhance your communication strategies, streamline workflows, and improve overall efficiency. I hope you find this guide helpful and that it empowers you to explore new possibilities in your technical endeavors. Thank you for reading, and happy coding !
Thanks