SMS texting via Powershell

by Jun 6, 2019

I have a script that collects data and serial number information from a workstation. It also emails me with an attachment of the collected data. I want to incorporate an SMS text message. Below is the current script I'm using.

#Clear the screen

#Create Folder
$MyFolder = New-Item -Force -Path 'c:Inventory' -ItemType Directory

#Change Directory
Set-Location -Path $MyFolder

#Create File
$text | Set-Content "$env:computername.txt"

#Write Asset Tag Number to file
"Asset Tag: "+ (Get-WmiObject win32_bios).SerialNumber | out-file "$env:computername.txt"

#Write Computer Name to file
"Computer Name: "+$env:COMPUTERNAME | out-file "$env:computername.txt" -Append

#Write Monitor Serial Numbers to file
Get-WmiObject WmiMonitorID -Namespace rootwmi|Select @{n="Make_Model"
out-file "$env:computername.txt" -Append

#get default printer
gwmi win32_printer | where { $_.Default } | out-file "$env:computername.txt" -Append

#Open Notepad
#start notepad "$env:computername.txt"

#Email the file
$Outlook = New-Object -ComObject Outlook.Application
$Mail = $Outlook.CreateItem(0)
$Mail.To = ""
$Mail.Subject = "Monitor-Inventory"
$Contacts = Get-Content "$env:computername.txt"
$File = "$env:computername.txt"
$Mail.Body = $Contacts | Out-String

#echo $Contacts
#echo $File