$MaxDays = ( Get - ADDefaultDomainPasswordPolicy ) .MaxPasswordAge.TotalDays

"<html><head><style>BODY{font-family: Arial; font-size: 10pt;}TABLE{border: 1px solid black; border-collapse: collapse;}TH{border: 1px solid black; background: #dddddd; padding: 5px; text-align: left; }TD{border: 1px solid black; padding: 5px; }</style></head><body><table><tr><th>Name</th><th>Days to Expire</th><th>Mobile Number</th><th>Description</th></tr>"

$SummaryBody = "<html><head><style>BODY{font-family: Arial; font-size: 10pt;}TABLE{border: 1px solid black; border-collapse: collapse;}TH{border: 1px solid black; background: #dddddd; padding: 5px; text-align: left; }TD{border: 1px solid black; padding: 5px; }</style></head><body><table><tr><th>Name</th><th>Days to Expire</th><th>Mobile Number</th><th>Description</th></tr>"

Invoke - WebRequest - Uri $APIURI -Credential ( New-Object System.Management.Automation.PSCredential ( $APIUser , $APIPass ) ) - Method Post - ContentType application / vnd.api + json -Body ( @ { to = $SMSTo ;from = $SMSFrom ;body = $SMSBody ;dlr_callback = $CallbackURI } | ConvertTo - Json )

Function Get - RandomCharacters ( $Length , $Characters ) {

$Random = 1 .. $Length | ForEach-Object { Get - Random -Maximum $Characters .Length }

-and

-and

-like

( Get - ADUser - Filter { ( MobilePhone -like "*-*" ) -and ( Enabled -eq "True" ) -and ( PasswordNeverExpires -eq "False" ) } - properties * ) | Sort-Object pwdLastSet |

If

If ( $DaysToExpire -le - 1 ) {

If

If ( $_ .Info -eq $null ) {

"MESSAGE TO USER"

Send - SMS - SMSTo $SMSTo - SMSFrom $SMSFrom - SMSBody "MESSAGE TO USER"

"<tr><td>$SamAccountName</td><td>$DaysToExpire</td><td>$SMSTo</td><td>User in initial onboarding phase</td></tr>"

$SummaryBody += "<tr><td>$SamAccountName</td><td>$DaysToExpire</td><td>$SMSTo</td><td>User in initial onboarding phase</td></tr>"

If

If ( $_ .Info -eq "I" ) {