Microsoft 365 Password Expiration Notification Email Solution for On-Premises AD Accounts

Published Oct 18 2021 12:00 AM 23.2K Views
Microsoft

"Hello Again World!"

Hi there! Mike Kullish, here. I'm a Microsoft Customer Engineer (CE) based just off the Gulf Coast of  Florida with a focus on AD, Hyper-V and DFS, but I try to help customers with anything on the Windows Desktop and/or Server platforms. (Also, this whole Azure thing has become a big deal, so I dabble with that as well…) I have been with Microsoft for over nine years and this is a follow-up to my first blog post written about 6 years ago which can be found here: How to Setup a Password Expiration Notification Email Solution - Microsoft Tech Community. The changes below help to eliminate the use of SMTP servers and allow you to use Microsoft Graph to send emails. This is a more modern take on the original article. I must acknowledge two of my CE colleagues that helped this update come together. First David Morillo, who assisted in wordsmithing the article, and secondly the mastermind behind the script that makes it all work, Daniel Carroll.

Have you ever had a need to configure notifications for user's password expirations but found that existing solutions didn't quite fit the bill? We all know you can use built-in solutions with Windows and Active Directory/Group Policy but this requires users to interactively log-on to a domain joined computer. What about those BYOD or mobile users or users of web apps/email? Typically, these users will have to call the helpdesk because they had no idea their domain passwords were going to expire. Statistics show that some of the most common calls to the helpdesk are password-related and implementing a process like the one covered here could really make a dent in your helpdesk call volume and costs.

The first article mentioned above enabled you to use an existing SMTP server to configure and send emails to users that had passwords which were about to expire. This solution was based on the Send-MailMessage cmdlet which is now considered obsolete. Below, we will describe the process to setup a script that uses Microsoft Graph to send email using your M365 subscription.

 

MichaelKullish_0-1632940746924.png

 

I thought it would make a helpful blog post to cover some of the details and considerations when implementing a solution like this. As mentioned, Daniel Carroll deserves credit for the script that follows.

 

DISCLAIMER:

  • The sample scripts are not supported under any Microsoft standard support program or service. The sample scripts are provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.
  • CEs don't normally provide code beyond sample or "proof of concept" code
  • The code we discuss here is an additional layer beyond code from a CE; it is code from a passion project of Dan’s that was trimmed to fit the need of this article.
  • As with ANY code, you should always test/validate its behavior in an isolated lab
  •  Did I mention you should test/validate the code? I have also validated that it works on Windows Server 2019 and Windows Server 2022.
  • If/when you're ready to deploy it to production, you should employ a solid change control process and a controlled release. This code can possibly generate emails to thousands of users .

You can download the script from the following link .  I will also post a full copy of the code within the article, but updates will be made more frequently on GitHub. ( Script to Automate Email Reminders when Users Passwords due to Expire using O365 Shared Mailbox · Gi... )

Click on the blue box and save the file to a workstation or member server. Obviously, a DC would work but likely isn't the best choice. The workstation or member server needs the RSAT tools for Active Directory installed. If you already have an "admin server" system where you have existing scripts, tools, Scheduled Tasks, etc., that would be a logical place for this. I would also suggest creating a folder such as C:\temp on the tools machine in order to ensure you can follow along easily with the instructions below.

 

 

#################################################################################################################
#
# Original Robert Pearman v1.4 Passowrd Change Notification
#    - Adapted to support O365 SendAS Shared Mailbox
# Script to Automate Email Reminders when Users Passwords due to Expire using O365 Shared Mailbox.
#
# Requires: 
#        Windows PowerShell Module for Active Directory
#        Azure AD Application registration with MS Graph Application Mail.Send permission
#
#
##################################################################################################################
# Please Configure the following variables....
$expireindays = 21
$logging = "Enabled" # Set to Disabled to Disable Logging
$logFile = "" # ie. c:\mylog.csv
$testing = "Enabled" # Set to Disabled to Email Users
$testRecipient = ''
$clientId = '' # App registration ID used to send on behalf of shared mailbox
$clientSecret = (Import-Clixml -Path $PSScriptRoot\SendEmailSecret.ps1.credential).GetNetworkCredential().Password #Client Secret credential file
$tenantName = '' #TenantName
$SendEmailAccount = '' #SharedMailbox name
$resource = 'https://graph.microsoft.com' #Graph Endpoint https://graph.microsoft.com or https://graph.microsoft.us or https://dod-graph.microsoft.us
#
###################################################################################################################

$ReqTokenBody = @{
    Grant_Type    = "client_credentials"
    Scope         = "$($resource)/.default"
    client_Id     = $clientID
    Client_Secret = $clientSecret
} 
Try {
    $params = @{
        Uri         = "https://login.microsoftonline.com/$TenantName/oauth2/v2.0/token"
        Method      = "POST"
        ErrorAction = "Stop"
    }
    $TokenResponse = Invoke-RestMethod @params -Body $ReqTokenBody

    if ($TokenResponse) {
        # Check Logging Settings
        if (($logging) -eq "Enabled")
        {
            # Test Log File Path
            $logfilePath = (Test-Path $logFile)
            if (($logFilePath) -ne "True")
            {
                # Create CSV File and Headers
                New-Item $logfile -ItemType File
                Add-Content $logfile "Date,Name,EmailAddress,DaystoExpire,ExpiresOn,Notified"
            }
        } # End Logging Check

        # System Settings
        $textEncoding = [System.Text.Encoding]::UTF8
        $date = Get-Date -format ddMMyyyy
        # End System Settings

        # Get Users From AD who are Enabled, Passwords Expire and are Not Currently Expired
        Import-Module ActiveDirectory
        $users = get-aduser -filter * -properties Name, PasswordNeverExpires, PasswordExpired, PasswordLastSet, EmailAddress |where {$_.Enabled -eq "True"} | where { $_.PasswordNeverExpires -eq $false } | where { $_.passwordexpired -eq $false }
        $DefaultmaxPasswordAge = (Get-ADDefaultDomainPasswordPolicy).MaxPasswordAge

        # Process Each User for Password Expiry
        foreach ($user in $users)
        {
            $Name = $user.Name
            $emailaddress = $user.emailaddress
            $passwordSetDate = $user.PasswordLastSet
            $PasswordPol = (Get-AduserResultantPasswordPolicy $user)
            $sent = "" # Reset Sent Flag
            # Check for Fine Grained Password
            if (($PasswordPol) -ne $null)
            {
                $maxPasswordAge = ($PasswordPol).MaxPasswordAge
            }
            else
            {
                # No FGP set to Domain Default
                $maxPasswordAge = $DefaultmaxPasswordAge
            }


            $expireson = $passwordsetdate + $maxPasswordAge
            $today = (get-date)
            $daystoexpire = (New-TimeSpan -Start $today -End $Expireson).Days

            # Set Greeting based on Number of Days to Expiry.

            # Check Number of Days to Expiry
            $messageDays = $daystoexpire

            if (($messageDays) -gt "1")
            {
                $messageDays = "in " + "$daystoexpire" + " days."
            }
            else
            {
                $messageDays = "today."
            }
                # If Testing Is Enabled - Email Administrator
            if (($testing) -eq "Enabled")
            {
                $emailaddress = $testRecipient
            } # End Testing

            # If a user has no email address listed
            if (($emailaddress) -eq $null)
            {
                $emailaddress = $testRecipient
            }# End No Valid Email

            # Email Subject Set Here
            $subject="Your password will expire $messageDays"

            # Email Body Set Here, Note You can use HTML.
            $body = @"
            {
              "Message": {
                "Subject": "$($subject)",
                "importance":"High",
                "Body": {
                  "ContentType": "HTML",
                  "Content": "<p>Dear $($name),</p>
            <p> Your Password will expire $($messageDays)<br>
            To change your password on a PC press CTRL ALT Delete and choose Change Password <br>
            <p>Thanks, <br>
            </P>"
                },
                "ToRecipients": [
                  {
                    "EmailAddress": {
                      "Address": "$($emailaddress)"
                    }
                  }
                ]
              },
              "SaveToSentItems": "false",
              "isDraft": "false"
            }
"@

            # Send Email Message
            if (($daystoexpire -ge "0") -and ($daystoexpire -lt $expireindays))
            {
                $sent = "Yes"
                # If Logging is Enabled Log Details
                if (($logging) -eq "Enabled")
                {
                    Add-Content $logfile "$date,$Name,$emailaddress,$daystoExpire,$expireson,$sent"
                }
                # Send Email Message
                $apiUrl = "$resource/v1.0/users/$SendEmailAccount/sendMail"
                Invoke-RestMethod -Headers @{Authorization = "Bearer $($Tokenresponse.access_token)"} -Uri $apiUrl -Body $Body -Method Post -ContentType 'application/json'

            } # End Send Message
            else # Log Non Expiring Password
            {
                $sent = "No"
                # If Logging is Enabled Log Details
                if (($logging) -eq "Enabled")
                {
                    Add-Content $logfile "$date,$Name,$emailaddress,$daystoExpire,$expireson,$sent"
                }
            }
        }

        } # End User Processing

} catch {
    [System.ApplicationException]::new("Failed to aquire token")
}

 

 

Once you have downloaded or created your own copy of the script:

  • Create a shared mailbox in M365 to be used if you haven’t already done so.
    • In the example for this article, we will use smtp1.contoso.com
  • Log into Azure AD and register a new App by selecting “App registrations”
    • Select New registration and fill in the fields as appropriate

2A.png

    • Click Register
  • Copy Application ID from the Overview section of the newly created SendMail app:

3A.png

 

  • Place Application (client) ID GUID on line 19 of script you downloaded
  • From the SendMail application blade in Azure AD Click on “Certificates & secrets”
    • Click on New client secret
    • Choose options like below or as appropriate for your organization

5B.png

  • Click Add when finished
    • When you create the secret, this is the only time you can get it (You should copy this to the clipboard and to a file if necessary): 3AA7Q~YSlo1235Pxvjq6U7vE6uanqXYZTOqC5
      • Don’t share this information. You will have to recreate the secret if you ever want it again and don’t save a copy.
  • Open an elevated PowerShell prompt
  • Run the following from an elevated PowerShell (This will add the client secret from your app to the script using DPAPI and pins the credentials to the tools machine based on the user running the script…am I stressing this point yet?):
    • $cred = ’3AA7Q~YSlo1235Pxvjq6U7vE6uanqXYZTOqC5'
      [System.Management.Automation.PSCredential]::new( "SendEmailCred", (ConvertTo-SecureString -String $cred -AsPlainText -Force) ) | Export-Clixml -Path C:\temp\test.ps1.credential
  • Fill in $tenantName and $testRecipient in script
  • Set Permissions on the app:
    • Goto the app you just created in Azure AD
    • Choose API Permissions from the blade on the left
    • Choose “Application permissions” and the Mail.Send permission while in the blade as depicted below:

7A.png

    • Choose Add permissions when ready
    • Then click on Grant admin consent for your domain when prompted

7B.png

    • You should then see permissions similar to the following:

7C.png

  • Place the .PS1 file in a directory on your admin server. (For this example, I will use C:\temp)
  • Edit the following portions of the script as applicable using Notepad or PowerShell ISE if you haven’t already done so:
    • $expireindays = 21 
      • This is the number of days prior to password expiration that you want to notify users. The actual number of days remaining before expiration will be displayed in the email notification.
    • $logging = "Enabled" # Set to Disabled to Disable Logging
      • Logging is recommended to ensure that you can trace any errors that might occur
    • $logFile = "C:\temp\pwdexplog.csv"
      • This field should be changed to a desired location on the local system or network share as desired.
    • $testing = "Enabled"
      • Set to Disabled to email users (configuring this to Enabled, runs a check against all accounts and sends emails ONLY the account specified in the $testRecipient field below.)
        • Configuring this to disabled actually sends emails to the users that will have their passwords expire in the configured amount of time.
        • Understand this - you risk sending out a mass-email to 10s, 100s or 10,000s of users.
        • This is automation – with great power, comes great responsibility
    • $testRecipient = "user@domain.com"
      • This will provide a test recipient email address to ensure the script is working properly
    • $clientId = ""
      • This will be the app registration ID used to send on behalf of as shared mailbox in use (example: 71267c5f-b88d-aaaa-a3e4-370d101234ac)
    • $tenantName = ""
      • This is the name of your tenant (Example: Contoso.onmicrosoft.com)
    • $SendEmailAccount = "someone@company.com"
    • $clientSecret  = (Import-Clixml -Path C:\Scripts\sendemailsecret.ps1.credential).GetNetworkCredential().password #Client Secret from AAD
      • This secret can be found by running the following on the tools machine. Note: It is important that the account running the following scripts is also the account used to manually run the PowerShell script manually or to run any scheduled tasks which may use the script from GitHub. (Reference Article: Export-Clixml (Microsoft.PowerShell.Utility) - PowerShell | Microsoft Docs)

 

 

$cred = '3BW7Q~YSlo2oS5Pxvjq6U7vE6uanqQnGTOqC5' 
[System.Management.Automation.PSCredential]::new( "SendEmailCred", (ConvertTo-SecureString -String $cred -AsPlainText -Force) ) | Export-Clixml -Path C:\temp\SendEmailSecret.ps1.credential

#The credential specified in $cred above should be gathered when creating the App Registration

 

 

  • Save the script once you are done editing it.
  • Now you can test the script by running it in a lab.
    • You may need to modify the execution policy for PowerShell scripts on your admin server machine.
  • You should get an email that looks something like this:
  • From: someone@company.com [mailto:someone@company.com]
    Sent: Thursday, September 28, 2021 12:52 PM
    To: Someone@company.com
    Dear chptest,

    To change your password on a PC press CTRL-ALT-Delete and choose Change Password

    Thanks,

 

  • It is important to ensure that you change the section of the script under $body .  The message should be modified to ensure that users don't accidentally delete the email because they suspect it is spam or a phishing email. Good inter-team collaboration and communication about this "password expiration notification process" cannot be emphasized enough.
    • Work with your helpdesk and security teams to ensure everyone signs off on this effort and approves the specific text and additional information for the email, including how to manage a 'reply' to that email address
  • When it all is working as desired/expected, you can disable testing:
    • $testing = "Disabled"

Now, at some pre-determined time, you or one of your staff can execute the script to generate the 'password expiry notification email' to the affected users.

For those who don't want to manually run the script, it's a simple process to create a Scheduled Task to run the script automatically. I would strongly suggest investigating the use of a Group Managed Service account rather than a traditional user account that runs a script or service, but that is a topic for another article.

There are numerous other ways to address this need; I have talked to many people who have developed their own processes, scripts and/or code for this. This particular process was pretty easy to implement, and I was able to work with my customers and my own lab environment to get the whole thing working in a short amount of time.

One last point of consideration would be to start moving away from passwords altogether. Think about multi-factor authentication (MFA), or passwordless solutions for an added bonus. One article that will help get you started can be found here: Azure Active Directory passwordless sign-in | Microsoft Docs.

Thanks again to David Morillo, Daniel Carroll, and everyone that responded to the original post to inspire this update.

 

See you all next time!

Mike "CANNONBALL!" Kullish

Michael Kullish -or- aka.ms/michaelkullish

 

 

 

 

57 Comments
%3CLINGO-SUB%20id%3D%22lingo-sub-2796353%22%20slang%3D%22en-US%22%3EMicrosoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2796353%22%20slang%3D%22en-US%22%3E%3CP%3E%22Hello%20Again%20World!%22%3C%2FP%3E%0A%3CP%3EHi%20there!%20Mike%20Kullish%2C%20here.%26nbsp%3BI'm%20a%20Microsoft%20Customer%20Engineer%20(CE)%20based%20just%20off%20the%20Gulf%20Coast%20of%20%26nbsp%3BFlorida%20with%20a%20focus%20on%26nbsp%3BAD%2C%20Hyper-V%20and%20DFS%2C%20but%20I%26nbsp%3Btry%20to%20help%20customers%20with%20anything%26nbsp%3Bon%20the%26nbsp%3BWindows%20Desktop%20and%2For%20Server%20platforms.%20(Also%2C%20this%20whole%20Azure%20thing%20has%20become%20a%20big%20deal%2C%20so%20I%20dabble%20with%20that%20as%20well%E2%80%A6)%26nbsp%3BI%20have%20been%20with%20Microsoft%20for%20over%20nine%20years%26nbsp%3Band%20this%20is%20a%20follow-up%20to%20my%20first%20blog%20post%20written%20about%206%20years%20ago%20which%20can%20be%20found%20here%3A%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fcore-infrastructure-and-security%2Fhow-to-setup-a-password-expiration-notification-email-solution%2Fbc-p%2F2767566%22%20target%3D%22_blank%22%3EHow%20to%20Setup%20a%20Password%20Expiration%20Notification%20Email%20Solution%20-%20Microsoft%20Tech%20Community%3C%2FA%3E.%20The%20changes%20below%20help%20to%20eliminate%20the%20use%20of%20SMTP%20servers%20and%20allow%20you%20to%20use%20Microsoft%20Graph%20to%20send%20emails.%20This%20is%20a%20more%20modern%20take%20on%20the%20original%20article.%20I%20must%20acknowledge%20two%20of%20my%20CE%20colleagues%20that%20helped%20this%20update%20come%20together.%20First%20David%20Morillo%2C%20who%20assisted%20in%20wordsmithing%20the%20article%2C%20and%20secondly%20the%20mastermind%20behind%20the%20script%20that%20makes%20it%20all%20work%2C%20Daniel%20Carroll.%3C%2FP%3E%0A%3CP%3EHave%20you%20ever%20had%20a%20need%20to%20configure%20notifications%20for%20user's%20password%20expirations%20but%20found%20that%20existing%20solutions%20didn't%20quite%20fit%20the%20bill%3F%20We%20all%20know%20you%20can%20use%20built-in%20solutions%20with%20Windows%20and%20Active%20Directory%2FGroup%20Policy%20but%20this%20requires%20users%20to%20interactively%20log-on%20to%20a%20domain%20joined%20computer.%20What%20about%20those%26nbsp%3BBYOD%20or%20mobile%20users%20or%26nbsp%3Busers%20of%20web%20apps%2Femail%3F%20Typically%2C%20these%20users%20will%20have%20to%20call%20the%20helpdesk%20because%20they%20had%20no%20idea%20their%20domain%20passwords%20were%20going%20to%20expire.%20Statistics%20show%20that%20some%20of%20the%20most%20common%20calls%20to%20the%20helpdesk%20are%20password-related%20and%20implementing%20a%26nbsp%3Bprocess%20like%20the%20one%20covered%20here%20could%20really%20make%20a%20dent%20in%20your%20helpdesk%20call%20volume%26nbsp%3Band%20costs.%3C%2FP%3E%0A%3CP%3EThe%20first%20article%20mentioned%20above%20enabled%20you%20to%20use%20an%20existing%20SMTP%20server%20to%20configure%20and%20send%20emails%20to%20users%20that%20had%20passwords%20which%20were%20about%20to%20expire.%20This%20solution%20was%20based%20on%20the%20Send-MailMessage%20cmdlet%20which%20is%20now%20considered%20obsolete.%20Below%2C%20we%20will%20describe%20the%20process%20to%20setup%20a%20script%20that%20uses%20Microsoft%20Graph%20to%20send%20email%20using%20your%20M365%20subscription.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22MichaelKullish_0-1632940746924.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22MichaelKullish_0-1632940746924.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22MichaelKullish_0-1632940746924.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22MichaelKullish_0-1632940746924.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22MichaelKullish_0-1632940746924.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22MichaelKullish_0-1632940746924.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22MichaelKullish_0-1632940746924.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22MichaelKullish_0-1632940746924.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22MichaelKullish_0-1632940746924.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22MichaelKullish_0-1632940746924.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22MichaelKullish_0-1632940746924.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22MichaelKullish_0-1632940746924.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22MichaelKullish_0-1632940746924.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22MichaelKullish_0-1632940746924.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22MichaelKullish_0-1632940746924.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F313699i64043D386E57F33F%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22MichaelKullish_0-1632940746924.png%22%20alt%3D%22MichaelKullish_0-1632940746924.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20thought%20it%20would%20make%20a%20helpful%20blog%20post%20to%20cover%20some%20of%20the%20details%20and%20considerations%20when%20implementing%20a%20solution%20like%20this.%20As%20mentioned%2C%20Daniel%20Carroll%20deserves%20credit%20for%20the%20script%20that%20follows.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDISCLAIMER%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EThe%20sample%20scripts%20are%20not%20supported%20under%20any%20Microsoft%20standard%20support%20program%20or%20service.%20The%20sample%20scripts%20are%20provided%20AS%20IS%20without%20warranty%20of%20any%20kind.%20Microsoft%20further%20disclaims%20all%20implied%20warranties%20including%2C%20without%20limitation%2C%20any%20implied%20warranties%20of%20merchantability%20or%20of%20fitness%20for%20a%20particular%20purpose.%20The%20entire%20risk%20arising%20out%20of%20the%20use%20or%20performance%20of%20the%20sample%20scripts%20and%20documentation%20remains%20with%20you.%20In%20no%20event%20shall%20Microsoft%2C%20its%20authors%2C%20or%20anyone%20else%20involved%20in%20the%20creation%2C%20production%2C%20or%20delivery%20of%20the%20scripts%20be%20liable%20for%20any%20damages%20whatsoever%20(including%2C%20without%20limitation%2C%20damages%20for%20loss%20of%20business%20profits%2C%20business%20interruption%2C%20loss%20of%20business%20information%2C%20or%20other%20pecuniary%20loss)%20arising%20out%20of%20the%20use%20of%20or%20inability%20to%20use%20the%20sample%20scripts%20or%20documentation%2C%20even%20if%20Microsoft%20has%20been%20advised%20of%20the%20possibility%20of%20such%20damages.%3C%2FLI%3E%0A%3CLI%3ECEs%20don't%20normally%20provide%20code%20beyond%20sample%20or%20%22proof%20of%20concept%22%20code%3C%2FLI%3E%0A%3CLI%3EThe%20code%20we%20discuss%20here%20is%20an%20additional%20layer%20beyond%26nbsp%3Bcode%20from%20a%20CE%3B%20it%20is%20code%20from%20a%20passion%20project%20of%20Dan%E2%80%99s%20that%20was%20trimmed%20to%20fit%20the%20need%20of%20this%20article.%3C%2FLI%3E%0A%3CLI%3EAs%20with%20ANY%20code%2C%20you%20should%20always%20test%2Fvalidate%20its%20behavior%20in%20an%20isolated%20lab%3C%2FLI%3E%0A%3CLI%3E%26nbsp%3BDid%20I%20mention%20you%20should%20test%2Fvalidate%20the%20code%3F%20I%20have%20also%20validated%20that%20it%20works%20on%20Windows%20Server%202019%20and%20Windows%20Server%202022.%3C%2FLI%3E%0A%3CLI%3EIf%2Fwhen%20you're%20ready%20to%20deploy%20it%20to%20production%2C%20you%20should%20employ%20a%20solid%20change%20control%20process%20and%20a%20controlled%20release.%26nbsp%3B%3CSTRONG%3EThis%20code%20can%20possibly%20generate%20emails%20to%20thousands%20of%20users%26nbsp%3B%3C%2FSTRONG%3E.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EYou%20can%20download%20the%20script%20from%20the%20following%26nbsp%3Blink%26nbsp%3B.%20%26nbsp%3BI%20will%20also%20post%20a%20full%20copy%20of%20the%20code%20within%20the%20article%2C%20but%20updates%20will%20be%20made%20more%20frequently%20on%20GitHub.%20(%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fgist.github.com%2Fdacarroll%2F12f53cb90052b29452a03571587519aa%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EScript%20to%20Automate%20Email%20Reminders%20when%20Users%20Passwords%20due%20to%20Expire%20using%20O365%20Shared%20Mailbox%20%C2%B7%20GitHub%3C%2FA%3E%26nbsp%3B)%3C%2FP%3E%0A%3CP%3EClick%20on%20the%20blue%20box%20and%20save%20the%20file%26nbsp%3Bto%20a%20workstation%20or%20member%20server.%20Obviously%2C%20a%20DC%20would%20work%20but%20likely%20isn't%20the%20best%20choice.%20The%20workstation%20or%20member%20server%20needs%20the%20RSAT%20tools%20for%20Active%20Directory%20installed.%20If%20you%20already%20have%20an%20%22admin%20server%22%26nbsp%3Bsystem%20where%20you%20have%20existing%20scripts%2C%20tools%2C%20Scheduled%20Tasks%2C%20etc.%2C%20that%20would%20be%20a%20logical%20place%20for%20this.%20I%20would%20also%20suggest%20creating%20a%20folder%20such%20as%20C%3A%5Ctemp%20on%20the%20tools%20machine%20in%20order%20to%20ensure%20you%20can%20follow%20along%20easily%20with%20the%20instructions%20below.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%0A%23%0A%23%20Original%20Robert%20Pearman%20v1.4%20Passowrd%20Change%20Notification%0A%23%20%20%20%20-%20Adapted%20to%20support%20O365%20SendAS%20Shared%20Mailbox%0A%23%20Script%20to%20Automate%20Email%20Reminders%20when%20Users%20Passwords%20due%20to%20Expire%20using%20O365%20Shared%20Mailbox.%0A%23%0A%23%20Requires%3A%20%0A%23%20%20%20%20%20%20%20%20Windows%20PowerShell%20Module%20for%20Active%20Directory%0A%23%20%20%20%20%20%20%20%20Azure%20AD%20Application%20registration%20with%20MS%20Graph%20Application%20Mail.Send%20permission%0A%23%0A%23%0A%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%0A%23%20Please%20Configure%20the%20following%20variables....%0A%24expireindays%20%3D%2021%0A%24logging%20%3D%20%22Enabled%22%20%23%20Set%20to%20Disabled%20to%20Disable%20Logging%0A%24logFile%20%3D%20%22%22%20%23%20ie.%20c%3A%5Cmylog.csv%0A%24testing%20%3D%20%22Enabled%22%20%23%20Set%20to%20Disabled%20to%20Email%20Users%0A%24testRecipient%20%3D%20''%0A%24clientId%20%3D%20''%20%23%20App%20registration%20ID%20used%20to%20send%20on%20behalf%20of%20shared%20mailbox%0A%24clientSecret%20%3D%20(Import-Clixml%20-Path%20%24PSScriptRoot%5CSendEmailSecret.ps1.credential).GetNetworkCredential().Password%20%23Client%20Secret%20credential%20file%0A%24tenantName%20%3D%20''%20%23TenantName%0A%24SendEmailAccount%20%3D%20''%20%23SharedMailbox%20name%0A%24resource%20%3D%20'https%3A%2F%2Fgraph.microsoft.com'%20%23Graph%20Endpoint%20https%3A%2F%2Fgraph.microsoft.com%20or%20https%3A%2F%2Fgraph.microsoft.us%20or%20https%3A%2F%2Fdod-graph.microsoft.us%0A%23%0A%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%0A%0A%24ReqTokenBody%20%3D%20%40%7B%0A%20%20%20%20Grant_Type%20%20%20%20%3D%20%22client_credentials%22%0A%20%20%20%20Scope%20%20%20%20%20%20%20%20%20%3D%20%22%24(%24resource)%2F.default%22%0A%20%20%20%20client_Id%20%20%20%20%20%3D%20%24clientID%0A%20%20%20%20Client_Secret%20%3D%20%24clientSecret%0A%7D%20%0ATry%20%7B%0A%20%20%20%20%24params%20%3D%20%40%7B%0A%20%20%20%20%20%20%20%20Uri%20%20%20%20%20%20%20%20%20%3D%20%22https%3A%2F%2Flogin.microsoftonline.com%2F%24TenantName%2Foauth2%2Fv2.0%2Ftoken%22%0A%20%20%20%20%20%20%20%20Method%20%20%20%20%20%20%3D%20%22POST%22%0A%20%20%20%20%20%20%20%20ErrorAction%20%3D%20%22Stop%22%0A%20%20%20%20%7D%0A%20%20%20%20%24TokenResponse%20%3D%20Invoke-RestMethod%20%40params%20-Body%20%24ReqTokenBody%0A%0A%20%20%20%20if%20(%24TokenResponse)%20%7B%0A%20%20%20%20%20%20%20%20%23%20Check%20Logging%20Settings%0A%20%20%20%20%20%20%20%20if%20((%24logging)%20-eq%20%22Enabled%22)%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%23%20Test%20Log%20File%20Path%0A%20%20%20%20%20%20%20%20%20%20%20%20%24logfilePath%20%3D%20(Test-Path%20%24logFile)%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20((%24logFilePath)%20-ne%20%22True%22)%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20Create%20CSV%20File%20and%20Headers%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20New-Item%20%24logfile%20-ItemType%20File%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Add-Content%20%24logfile%20%22Date%2CName%2CEmailAddress%2CDaystoExpire%2CExpiresOn%2CNotified%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%7D%20%23%20End%20Logging%20Check%0A%0A%20%20%20%20%20%20%20%20%23%20System%20Settings%0A%20%20%20%20%20%20%20%20%24textEncoding%20%3D%20%5BSystem.Text.Encoding%5D%3A%3AUTF8%0A%20%20%20%20%20%20%20%20%24date%20%3D%20Get-Date%20-format%20ddMMyyyy%0A%20%20%20%20%20%20%20%20%23%20End%20System%20Settings%0A%0A%20%20%20%20%20%20%20%20%23%20Get%20Users%20From%20AD%20who%20are%20Enabled%2C%20Passwords%20Expire%20and%20are%20Not%20Currently%20Expired%0A%20%20%20%20%20%20%20%20Import-Module%20ActiveDirectory%0A%20%20%20%20%20%20%20%20%24users%20%3D%20get-aduser%20-filter%20*%20-properties%20Name%2C%20PasswordNeverExpires%2C%20PasswordExpired%2C%20PasswordLastSet%2C%20EmailAddress%20%7Cwhere%20%7B%24_.Enabled%20-eq%20%22True%22%7D%20%7C%20where%20%7B%20%24_.PasswordNeverExpires%20-eq%20%24false%20%7D%20%7C%20where%20%7B%20%24_.passwordexpired%20-eq%20%24false%20%7D%0A%20%20%20%20%20%20%20%20%24DefaultmaxPasswordAge%20%3D%20(Get-ADDefaultDomainPasswordPolicy).MaxPasswordAge%0A%0A%20%20%20%20%20%20%20%20%23%20Process%20Each%20User%20for%20Password%20Expiry%0A%20%20%20%20%20%20%20%20foreach%20(%24user%20in%20%24users)%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%24Name%20%3D%20%24user.Name%0A%20%20%20%20%20%20%20%20%20%20%20%20%24emailaddress%20%3D%20%24user.emailaddress%0A%20%20%20%20%20%20%20%20%20%20%20%20%24passwordSetDate%20%3D%20%24user.PasswordLastSet%0A%20%20%20%20%20%20%20%20%20%20%20%20%24PasswordPol%20%3D%20(Get-AduserResultantPasswordPolicy%20%24user)%0A%20%20%20%20%20%20%20%20%20%20%20%20%24sent%20%3D%20%22%22%20%23%20Reset%20Sent%20Flag%0A%20%20%20%20%20%20%20%20%20%20%20%20%23%20Check%20for%20Fine%20Grained%20Password%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20((%24PasswordPol)%20-ne%20%24null)%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24maxPasswordAge%20%3D%20(%24PasswordPol).MaxPasswordAge%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20else%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20No%20FGP%20set%20to%20Domain%20Default%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24maxPasswordAge%20%3D%20%24DefaultmaxPasswordAge%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%24expireson%20%3D%20%24passwordsetdate%20%2B%20%24maxPasswordAge%0A%20%20%20%20%20%20%20%20%20%20%20%20%24today%20%3D%20(get-date)%0A%20%20%20%20%20%20%20%20%20%20%20%20%24daystoexpire%20%3D%20(New-TimeSpan%20-Start%20%24today%20-End%20%24Expireson).Days%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%23%20Set%20Greeting%20based%20on%20Number%20of%20Days%20to%20Expiry.%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%23%20Check%20Number%20of%20Days%20to%20Expiry%0A%20%20%20%20%20%20%20%20%20%20%20%20%24messageDays%20%3D%20%24daystoexpire%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20((%24messageDays)%20-gt%20%221%22)%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24messageDays%20%3D%20%22in%20%22%20%2B%20%22%24daystoexpire%22%20%2B%20%22%20days.%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20else%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24messageDays%20%3D%20%22today.%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20If%20Testing%20Is%20Enabled%20-%20Email%20Administrator%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20((%24testing)%20-eq%20%22Enabled%22)%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24emailaddress%20%3D%20%24testRecipient%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%23%20End%20Testing%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%23%20If%20a%20user%20has%20no%20email%20address%20listed%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20((%24emailaddress)%20-eq%20%24null)%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24emailaddress%20%3D%20%24testRecipient%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%23%20End%20No%20Valid%20Email%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%23%20Email%20Subject%20Set%20Here%0A%20%20%20%20%20%20%20%20%20%20%20%20%24subject%3D%22Your%20password%20will%20expire%20%24messageDays%22%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%23%20Email%20Body%20Set%20Here%2C%20Note%20You%20can%20use%20HTML.%0A%20%20%20%20%20%20%20%20%20%20%20%20%24body%20%3D%20%40%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22Message%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22Subject%22%3A%20%22%24(%24subject)%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22importance%22%3A%22High%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22Body%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22ContentType%22%3A%20%22HTML%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22Content%22%3A%20%22%3CP%3EDear%20%24(%24name)%2C%3C%2FP%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CP%3E%20Your%20Password%20will%20expire%20%24(%24messageDays)%3CBR%20%2F%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20To%20change%20your%20password%20on%20a%20PC%20press%20CTRL%20ALT%20Delete%20and%20choose%20Change%20Password%20%3CBR%20%2F%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3C%2FP%3E%3CP%3EThanks%2C%20%3CBR%20%2F%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3C%2FP%3E%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22ToRecipients%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22EmailAddress%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22Address%22%3A%20%22%24(%24emailaddress)%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22SaveToSentItems%22%3A%20%22false%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22isDraft%22%3A%20%22false%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%22%40%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%23%20Send%20Email%20Message%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20((%24daystoexpire%20-ge%20%220%22)%20-and%20(%24daystoexpire%20-lt%20%24expireindays))%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24sent%20%3D%20%22Yes%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20If%20Logging%20is%20Enabled%20Log%20Details%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if%20((%24logging)%20-eq%20%22Enabled%22)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Add-Content%20%24logfile%20%22%24date%2C%24Name%2C%24emailaddress%2C%24daystoExpire%2C%24expireson%2C%24sent%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20Send%20Email%20Message%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24apiUrl%20%3D%20%22%24resource%2Fv1.0%2Fusers%2F%24SendEmailAccount%2FsendMail%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Invoke-RestMethod%20-Headers%20%40%7BAuthorization%20%3D%20%22Bearer%20%24(%24Tokenresponse.access_token)%22%7D%20-Uri%20%24apiUrl%20-Body%20%24Body%20-Method%20Post%20-ContentType%20'application%2Fjson'%0A%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%23%20End%20Send%20Message%0A%20%20%20%20%20%20%20%20%20%20%20%20else%20%23%20Log%20Non%20Expiring%20Password%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24sent%20%3D%20%22No%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20If%20Logging%20is%20Enabled%20Log%20Details%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if%20((%24logging)%20-eq%20%22Enabled%22)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Add-Content%20%24logfile%20%22%24date%2C%24Name%2C%24emailaddress%2C%24daystoExpire%2C%24expireson%2C%24sent%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20%20%20%7D%20%23%20End%20User%20Processing%0A%0A%7D%20catch%20%7B%0A%20%20%20%20%5BSystem.ApplicationException%5D%3A%3Anew(%22Failed%20to%20aquire%20token%22)%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOnce%20you%20have%20downloaded%20or%20created%20your%20own%20copy%20of%20the%20script%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3ECreate%20a%20shared%20mailbox%20in%20M365%20to%20be%20used%20if%20you%20haven%E2%80%99t%20already%20done%20so.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3COL%3E%0A%3CUL%3E%0A%3CLI%3EIn%20the%20example%20for%20this%20article%2C%20we%20will%20use%20smtp1.contoso.com%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FOL%3E%0A%3CUL%3E%0A%3CLI%3ELog%20into%20Azure%20AD%20and%20register%20a%20new%20App%20by%20selecting%20%E2%80%9CApp%20registrations%E2%80%9D%3CUL%3E%0A%3CLI%3ESelect%20New%20registration%20and%20fill%20in%20the%20fields%20as%20appropriate%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%222A.png%22%20style%3D%22width%3A%20605px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222A.png%22%20style%3D%22width%3A%20605px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222A.png%22%20style%3D%22width%3A%20605px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222A.png%22%20style%3D%22width%3A%20605px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222A.png%22%20style%3D%22width%3A%20605px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222A.png%22%20style%3D%22width%3A%20605px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222A.png%22%20style%3D%22width%3A%20605px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222A.png%22%20style%3D%22width%3A%20605px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222A.png%22%20style%3D%22width%3A%20605px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222A.png%22%20style%3D%22width%3A%20605px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222A.png%22%20style%3D%22width%3A%20605px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222A.png%22%20style%3D%22width%3A%20605px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222A.png%22%20style%3D%22width%3A%20605px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222A.png%22%20style%3D%22width%3A%20605px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%222A.png%22%20style%3D%22width%3A%20605px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F313770i5A0A2738A2AF4E3F%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%222A.png%22%20alt%3D%222A.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%20style%3D%22list-style-type%3A%20none%3B%22%3E%3CUL%3E%0A%3CLI%3EClick%20Register%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3ECopy%20Application%20ID%20from%20the%20Overview%20section%20of%20the%20newly%20created%20SendMail%20app%3A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%223A.png%22%20style%3D%22width%3A%20594px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%223A.png%22%20style%3D%22width%3A%20594px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%223A.png%22%20style%3D%22width%3A%20594px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%223A.png%22%20style%3D%22width%3A%20594px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%223A.png%22%20style%3D%22width%3A%20594px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%223A.png%22%20style%3D%22width%3A%20594px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%223A.png%22%20style%3D%22width%3A%20594px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%223A.png%22%20style%3D%22width%3A%20594px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%223A.png%22%20style%3D%22width%3A%20594px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%223A.png%22%20style%3D%22width%3A%20594px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%223A.png%22%20style%3D%22width%3A%20594px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%223A.png%22%20style%3D%22width%3A%20594px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%223A.png%22%20style%3D%22width%3A%20594px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%223A.png%22%20style%3D%22width%3A%20594px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%223A.png%22%20style%3D%22width%3A%20594px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F313774i249FCDA06EBBCD23%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%223A.png%22%20alt%3D%223A.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EPlace%20Application%20(client)%20ID%20GUID%20on%20line%2019%20of%20script%20you%20downloaded%3C%2FLI%3E%0A%3CLI%3EFrom%20the%20SendMail%20application%20blade%20in%20Azure%20AD%20Click%20on%20%E2%80%9CCertificates%20%26amp%3B%20secrets%E2%80%9D%3CUL%3E%0A%3CLI%3EClick%20on%20New%20client%20secret%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CLI%20style%3D%22list-style-type%3A%20none%3B%22%3E%3CUL%3E%0A%3CLI%3EChoose%20options%20like%20below%20or%20as%20appropriate%20for%20your%20organization%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%225B.png%22%20style%3D%22width%3A%20707px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%225B.png%22%20style%3D%22width%3A%20707px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%225B.png%22%20style%3D%22width%3A%20707px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%225B.png%22%20style%3D%22width%3A%20707px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%225B.png%22%20style%3D%22width%3A%20707px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%225B.png%22%20style%3D%22width%3A%20707px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%225B.png%22%20style%3D%22width%3A%20707px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%225B.png%22%20style%3D%22width%3A%20707px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%225B.png%22%20style%3D%22width%3A%20707px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%225B.png%22%20style%3D%22width%3A%20707px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%225B.png%22%20style%3D%22width%3A%20707px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%225B.png%22%20style%3D%22width%3A%20707px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%225B.png%22%20style%3D%22width%3A%20707px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%225B.png%22%20style%3D%22width%3A%20707px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%225B.png%22%20style%3D%22width%3A%20707px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F313777i40B26925E037D3C3%2Fimage-dimensions%2F707x212%3Fv%3Dv2%22%20width%3D%22707%22%20height%3D%22212%22%20role%3D%22button%22%20title%3D%225B.png%22%20alt%3D%225B.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EClick%20Add%20when%20finished%3CUL%3E%0A%3CLI%3EWhen%20you%20create%20the%20secret%2C%20this%20is%20the%20only%20time%20you%20can%20get%20it%20(You%20should%20copy%20this%20to%20the%20clipboard%20and%20to%20a%20file%20if%20necessary)%3A%203AA7Q~YSlo1235Pxvjq6U7vE6uanqXYZTOqC5%3CUL%3E%0A%3CLI%3EDon%E2%80%99t%20share%20this%20information.%20You%20will%20have%20to%20recreate%20the%20secret%20if%20you%20ever%20want%20it%20again%20and%20don%E2%80%99t%20save%20a%20copy.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3EOpen%20an%20elevated%20PowerShell%20prompt%3C%2FLI%3E%0A%3CLI%3ERun%20the%20following%20from%20an%20elevated%20PowerShell%20(This%20will%20add%20the%20client%20secret%20from%20your%20app%20to%20the%20script%20using%20DPAPI%20and%20pins%20the%20credentials%20to%20the%20tools%20machine%20based%20on%20the%20user%20running%20the%20script%E2%80%A6am%20I%20stressing%20this%20point%20yet%3F)%3A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CLI%20style%3D%22list-style-type%3A%20none%3B%22%3E%3CUL%3E%0A%3CLI%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%24cred%20%3D%20%E2%80%993AA7Q~YSlo1235Pxvjq6U7vE6uanqXYZTOqC5'%0A%5BSystem.Management.Automation.PSCredential%5D%3A%3Anew(%20%22SendEmailCred%22%2C%20(ConvertTo-SecureString%20-String%20%24cred%20-AsPlainText%20-Force)%20)%20%7C%20Export-Clixml%20-Path%20C%3A%5Ctemp%5Ctest.ps1.credential%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3EFill%20in%20%24tenantName%20and%20%24testRecipient%20in%20script%3C%2FLI%3E%0A%3CLI%3ESet%20Permissions%20on%20the%20app%3A%3CUL%3E%0A%3CLI%3EGoto%20the%20app%20you%20just%20created%20in%20Azure%20AD%3C%2FLI%3E%0A%3CLI%3EChoose%20API%20Permissions%20from%20the%20blade%20on%20the%20left%3C%2FLI%3E%0A%3CLI%3EChoose%20%E2%80%9CApplication%20permissions%E2%80%9D%20and%20the%20Mail.Send%20permission%20while%20in%20the%20blade%20as%20depicted%20below%3A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%227A.png%22%20style%3D%22width%3A%20894px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227A.png%22%20style%3D%22width%3A%20894px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227A.png%22%20style%3D%22width%3A%20894px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227A.png%22%20style%3D%22width%3A%20894px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227A.png%22%20style%3D%22width%3A%20894px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227A.png%22%20style%3D%22width%3A%20894px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227A.png%22%20style%3D%22width%3A%20894px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227A.png%22%20style%3D%22width%3A%20894px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227A.png%22%20style%3D%22width%3A%20894px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227A.png%22%20style%3D%22width%3A%20894px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227A.png%22%20style%3D%22width%3A%20894px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227A.png%22%20style%3D%22width%3A%20894px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227A.png%22%20style%3D%22width%3A%20894px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227A.png%22%20style%3D%22width%3A%20894px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227A.png%22%20style%3D%22width%3A%20894px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F313736iF96FFF62A9861C77%2Fimage-dimensions%2F894x917%3Fv%3Dv2%22%20width%3D%22894%22%20height%3D%22917%22%20role%3D%22button%22%20title%3D%227A.png%22%20alt%3D%227A.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%20style%3D%22list-style-type%3A%20none%3B%22%3E%3CUL%3E%0A%3CLI%3EChoose%20Add%20permissions%20when%20ready%3C%2FLI%3E%0A%3CLI%3EThen%20click%20on%20Grant%20admin%20consent%20for%20your%20domain%20when%20prompted%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%227B.png%22%20style%3D%22width%3A%20604px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227B.png%22%20style%3D%22width%3A%20604px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227B.png%22%20style%3D%22width%3A%20604px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227B.png%22%20style%3D%22width%3A%20604px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227B.png%22%20style%3D%22width%3A%20604px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227B.png%22%20style%3D%22width%3A%20604px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227B.png%22%20style%3D%22width%3A%20604px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227B.png%22%20style%3D%22width%3A%20604px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227B.png%22%20style%3D%22width%3A%20604px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227B.png%22%20style%3D%22width%3A%20604px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227B.png%22%20style%3D%22width%3A%20604px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227B.png%22%20style%3D%22width%3A%20604px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227B.png%22%20style%3D%22width%3A%20604px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227B.png%22%20style%3D%22width%3A%20604px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227B.png%22%20style%3D%22width%3A%20604px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F313779i47324AA538A5B1B1%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%227B.png%22%20alt%3D%227B.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%20style%3D%22list-style-type%3A%20none%3B%22%3E%3CUL%3E%0A%3CLI%3EYou%20should%20then%20see%20permissions%20similar%20to%20the%20following%3A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%227C.png%22%20style%3D%22width%3A%20706px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227C.png%22%20style%3D%22width%3A%20706px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227C.png%22%20style%3D%22width%3A%20706px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227C.png%22%20style%3D%22width%3A%20706px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227C.png%22%20style%3D%22width%3A%20706px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227C.png%22%20style%3D%22width%3A%20706px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227C.png%22%20style%3D%22width%3A%20706px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227C.png%22%20style%3D%22width%3A%20706px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227C.png%22%20style%3D%22width%3A%20706px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227C.png%22%20style%3D%22width%3A%20706px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227C.png%22%20style%3D%22width%3A%20706px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227C.png%22%20style%3D%22width%3A%20706px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227C.png%22%20style%3D%22width%3A%20706px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227C.png%22%20style%3D%22width%3A%20706px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%227C.png%22%20style%3D%22width%3A%20706px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F313933i2CAFA9484EB9AA66%2Fimage-dimensions%2F706x471%3Fv%3Dv2%22%20width%3D%22706%22%20height%3D%22471%22%20role%3D%22button%22%20title%3D%227C.png%22%20alt%3D%227C.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EPlace%20the%20.PS1%20file%20in%20a%20directory%20on%20your%20admin%20server.%20(For%20this%20example%2C%20I%20will%20use%20C%3A%5Ctemp)%3C%2FLI%3E%0A%3CLI%3EEdit%20the%20following%20portions%20of%20the%20script%20as%20applicable%26nbsp%3Busing%20Notepad%20or%20PowerShell%20ISE%20if%20you%20haven%E2%80%99t%20already%20done%20so%3A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3E%24expireindays%20%3D%2021%3C%2FSTRONG%3E%26nbsp%3B%3CUL%3E%0A%3CLI%3EThis%20is%20the%20number%20of%20days%20prior%20to%20password%20expiration%26nbsp%3Bthat%20you%20want%20to%20notify%20users.%20The%20actual%20number%20of%20days%20remaining%26nbsp%3Bbefore%20expiration%20will%20be%20displayed%20in%20the%20email%20notification.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3E%24logging%20%3D%20%22Enabled%22%20%23%20Set%20to%20Disabled%20to%20Disable%20Logging%3C%2FSTRONG%3E%3CUL%3E%0A%3CLI%3ELogging%20is%20recommended%20to%20ensure%20that%20you%20can%20trace%20any%20errors%20that%20might%20occur%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3E%24logFile%20%3D%20%22C%3A%5Ctemp%5Cpwdexplog.csv%22%3C%2FSTRONG%3E%3CUL%3E%0A%3CLI%3EThis%20field%20should%20be%20changed%20to%20a%20desired%20location%20on%20the%20local%20system%20or%20network%20share%20as%20desired.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3E%24testing%20%3D%20%22Enabled%22%3C%2FSTRONG%3E%3CUL%3E%0A%3CLI%3ESet%20to%20Disabled%20to%20email%20users%20(configuring%20this%26nbsp%3Bto%20Enabled%2C%20runs%20a%26nbsp%3Bcheck%26nbsp%3Bagainst%20all%20accounts%20and%26nbsp%3Bsends%20emails%20ONLY%20the%26nbsp%3Baccount%20specified%20in%20the%20%24testRecipient%20field%20below.)%3CUL%3E%0A%3CLI%3E%3CEM%3EConfiguring%20this%20to%26nbsp%3B%3CSTRONG%3Edisabled%26nbsp%3Bactually%20sends%20emails%20to%20the%20users%26nbsp%3B%3C%2FSTRONG%3Ethat%20will%20have%20their%20passwords%20expire%20in%20the%20configured%20amount%20of%20time.%3C%2FEM%3E%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3E%3CEM%3EUnderstand%20this%26nbsp%3B%3C%2FEM%3E%3C%2FSTRONG%3E%3CEM%3E-%20you%20risk%20sending%20out%20a%20mass-email%20to%2010s%2C%20100s%20or%2010%2C000s%20of%20users.%3C%2FEM%3E%3C%2FLI%3E%0A%3CLI%3E%3CEM%3EThis%20is%20automation%20%E2%80%93%20with%20great%20power%2C%20comes%20great%20responsibility%3C%2FEM%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3E%24testRecipient%20%3D%20%22user%40domain.com%22%3C%2FSTRONG%3E%3CUL%3E%0A%3CLI%3EThis%20will%20provide%20a%20test%20recipient%20email%20address%20to%20ensure%20the%20script%20is%20working%20properly%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3E%24clientId%20%3D%20%22%22%3C%2FSTRONG%3E%3CUL%3E%0A%3CLI%3EThis%20will%20be%20the%20app%20registration%20ID%20used%20to%20send%20on%20behalf%20of%20as%20shared%20mailbox%20in%20use%20(example%3A%2071267c5f-b88d-aaaa-a3e4-370d101234ac)%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3E%24tenantName%20%3D%20%22%22%3C%2FSTRONG%3E%3CUL%3E%0A%3CLI%3EThis%20is%20the%20name%20of%20your%20tenant%20(Example%3A%20Contoso.onmicrosoft.com)%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3E%24SendEmailAccount%20%3D%20%22someone%40company.com%22%3C%2FSTRONG%3E%3CUL%3E%0A%3CLI%3ESpecifies%20the%20shared%20mailbox%20name.%20(Example%3A%20%3CA%20href%3D%22mailto%3AM365mailbox%40contoso.com%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CEM%3EM365mailbox%40contoso.com%3C%2FEM%3E%3C%2FA%3E%3CEM%3E)%3C%2FEM%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3E%24clientSecret%20%26nbsp%3B%3D%20%3C%2FSTRONG%3E(Import-Clixml%20-Path%20C%3A%5CScripts%5Csendemailsecret.ps1.credential).GetNetworkCredential().password%20%23Client%20Secret%20from%20AAD%3CUL%3E%0A%3CLI%3E%3CEM%3EThis%20secret%20can%20be%20found%20by%20running%20the%20following%20on%20the%20tools%20machine.%20%3CSTRONG%3ENote%3A%20It%20is%20important%20that%20the%20account%20running%20the%20following%20scripts%20is%20also%20the%20account%20used%20to%20manually%20run%20the%20PowerShell%20script%20manually%20or%20to%20run%20any%20scheduled%20tasks%20which%20may%20use%20the%20script%20from%20GitHub.%20(Reference%20Article%3A%20%3C%2FSTRONG%3E%3C%2FEM%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fmicrosoft.powershell.utility%2Fexport-clixml%3Fview%3Dpowershell-7.1%23example-3--encrypt-an-exported-credential-object-on-windows%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EExport-Clixml%20(Microsoft.PowerShell.Utility)%20-%20PowerShell%20%7C%20Microsoft%20Docs%3C%2FA%3E%3CSTRONG%3E%3CEM%3E)%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%24cred%20%3D%20'3BW7Q~YSlo2oS5Pxvjq6U7vE6uanqQnGTOqC5'%20%0A%5BSystem.Management.Automation.PSCredential%5D%3A%3Anew(%20%22SendEmailCred%22%2C%20(ConvertTo-SecureString%20-String%20%24cred%20-AsPlainText%20-Force)%20)%20%7C%20Export-Clixml%20-Path%20C%3A%5Ctemp%5CSendEmailSecret.ps1.credential%0A%0A%23The%20credential%20specified%20in%20%24cred%20above%20should%20be%20gathered%20when%20creating%20the%20App%20Registration%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3ESave%20the%20script%20once%20you%20are%20done%20editing%20it.%3C%2FLI%3E%0A%3CLI%3ENow%20you%20can%20test%20the%20script%20by%20running%20it%26nbsp%3Bin%20a%20lab.%3CUL%3E%0A%3CLI%3EYou%20may%20need%20to%20modify%20the%20execution%20policy%20for%20PowerShell%20scripts%20on%20your%20admin%20server%20machine.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3EYou%20should%20get%20an%20email%20that%20looks%20something%20like%20this%3A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CLI%20style%3D%22list-style-type%3A%20none%3B%22%3E%3CP%3E%3CSTRONG%3E%3CEM%3EFrom%3A%20someone%40company.com%20%5Bmailto%3Asomeone%40company.com%5D%3C%2FEM%3E%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3E%3CEM%3ESent%3A%20Thursday%2C%20September%2028%2C%202021%2012%3A52%20PM%3C%2FEM%3E%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3E%3CEM%3ETo%3A%20Someone%40company.com%3C%2FEM%3E%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3E%3CEM%3EDear%20chptest%2C%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3ETo%20change%20your%20password%20on%20a%20PC%20press%20CTRL-ALT-Delete%20and%20choose%20Change%20Password%20%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3EThanks%2C%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EIt%20is%20important%20to%20ensure%20that%20you%20change%20the%20section%20of%20the%20script%20under%26nbsp%3B%24body%26nbsp%3B.%26nbsp%3B%20The%20message%20should%20be%20modified%20to%20ensure%20that%20users%20don't%20accidentally%20delete%20the%20email%20because%20they%20suspect%20it%20is%20spam%20or%20a%20phishing%20email.%26nbsp%3BGood%20inter-team%20collaboration%20and%20communication%20about%20this%20%22password%20expiration%20notification%20process%22%20cannot%20be%20emphasized%20enough.%3CUL%3E%0A%3CLI%3EWork%20with%20your%20helpdesk%20and%20security%20teams%20to%20ensure%20everyone%20signs%20off%20on%20this%20effort%20and%20approves%20the%20specific%20text%20and%20additional%20information%20for%20the%20email%2C%20including%26nbsp%3Bhow%20to%20manage%20a%20'reply'%20to%20that%20email%20address%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3EWhen%20it%26nbsp%3Ball%20is%20working%26nbsp%3Bas%20desired%2Fexpected%2C%20you%20can%20disable%26nbsp%3Btesting%3A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3E%24testing%20%3D%20%22Disabled%22%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3ENow%2C%20at%20some%20pre-determined%20time%2C%20you%20or%20one%20of%20your%20staff%20can%20execute%20the%20script%20to%20generate%20the%20'password%20expiry%20notification%20email'%20to%20the%20affected%20users.%3C%2FP%3E%0A%3CP%3EFor%20those%20who%20don't%20want%20to%20manually%20run%20the%20script%2C%20it's%20a%20simple%20process%20to%20create%20a%20Scheduled%20Task%20to%20run%20the%20script%20automatically.%20I%20would%20strongly%20suggest%20investigating%20the%20use%20of%20a%20Group%20Managed%20Service%20account%20rather%20than%20a%20traditional%20user%20account%20that%20runs%20a%20script%20or%20service%2C%20but%20that%20is%20a%20topic%20for%20another%20article.%3C%2FP%3E%0A%3CP%3EThere%20are%20numerous%20other%20ways%20to%20address%20this%20need%3B%26nbsp%3BI%20have%20talked%20to%20many%26nbsp%3Bpeople%20who%20have%20developed%20their%20own%20processes%2C%20scripts%20and%2For%20code%20for%20this.%20This%20particular%20process%26nbsp%3Bwas%26nbsp%3Bpretty%20easy%20to%20implement%2C%20and%20I%20was%20able%20to%20work%20with%20my%20customers%20and%20my%20own%20lab%20environment%20to%20get%20the%20whole%20thing%20working%20in%20a%20short%20amount%20of%20time.%3C%2FP%3E%0A%3CP%3EOne%20last%20point%20of%20consideration%20would%20be%20to%20start%20moving%20away%20from%20passwords%20altogether.%20Think%20about%20multi-factor%20authentication%20(MFA)%2C%20or%20passwordless%20solutions%20for%20an%20added%20bonus.%20One%20article%20that%20will%20help%20get%20you%20started%20can%20be%20found%20here%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Factive-directory%2Fauthentication%2Fconcept-authentication-passwordless%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Active%20Directory%20passwordless%20sign-in%20%7C%20Microsoft%20Docs%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3EThanks%20again%20to%20David%20Morillo%2C%20Daniel%20Carroll%2C%20and%20everyone%20that%20responded%20to%20the%20original%20post%20to%20inspire%20this%20update.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESee%20you%20all%20next%20time!%3C%2FP%3E%0A%3CP%3EMike%20%22CANNONBALL!%22%20Kullish%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmichael-kullish%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EMichael%20Kullish%3C%2FA%3E%26nbsp%3B-or-%20aka.ms%2Fmichaelkullish%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-2796353%22%20slang%3D%22en-US%22%3E%3CP%3EForget%20about%20SMTP%2C%20this%20article%20will%20help%20you%20configure%20Email%20notifications%20for%20Active%20Directory%20users%20that%20have%20expiring%20passwords%20by%20utilizing%20Microsoft%20Graph%2C%20and%20M365.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22M365Logo.jpg%22%20style%3D%22width%3A%20253px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22M365Logo.jpg%22%20style%3D%22width%3A%20253px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22M365Logo.jpg%22%20style%3D%22width%3A%20253px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22M365Logo.jpg%22%20style%3D%22width%3A%20253px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22M365Logo.jpg%22%20style%3D%22width%3A%20253px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22M365Logo.jpg%22%20style%3D%22width%3A%20253px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22M365Logo.jpg%22%20style%3D%22width%3A%20253px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22M365Logo.jpg%22%20style%3D%22width%3A%20253px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22M365Logo.jpg%22%20style%3D%22width%3A%20253px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22M365Logo.jpg%22%20style%3D%22width%3A%20253px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22M365Logo.jpg%22%20style%3D%22width%3A%20253px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22M365Logo.jpg%22%20style%3D%22width%3A%20253px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22M365Logo.jpg%22%20style%3D%22width%3A%20253px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22M365Logo.jpg%22%20style%3D%22width%3A%20253px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22M365Logo.jpg%22%20style%3D%22width%3A%20253px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F313710i308E7901609BDBD2%2Fimage-dimensions%2F253x136%3Fv%3Dv2%22%20width%3D%22253%22%20height%3D%22136%22%20role%3D%22button%22%20title%3D%22M365Logo.jpg%22%20alt%3D%22M365Logo.jpg%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2796353%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMichaelKullish%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2921398%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2921398%22%20slang%3D%22en-US%22%3E%3CP%3EI%20had%20a%20question%20about%20the%20Redirect%20URL%2C%20how%20do%20i%20obtain%20that%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2938385%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2938385%22%20slang%3D%22en-US%22%3E%3CP%3ESo%20when%20using%20a%20group%20managed%20service%20account%20(gMSA)%20to%20run%20scheduled%20tasks%20you%20have%20to%20run%20this%20also%20under%20this%20gMSA%20service%20account%3F%3A%3CBR%20%2F%3E%3CEM%3E'.%20Note%26nbsp%3B%24clientSecret%3A%20It%20is%20important%20that%20the%20account%20running%20the%20following%20scripts%20is%20also%20the%20account%20used%20to%20manually%20run%20the%20PowerShell%20script%20manually%20or%20to%20run%20any%20scheduled%20tasks%20which%20may%20use%20the%20script%20from%20GitHub.'%3C%2FEM%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2932200%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2932200%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F241879%22%20target%3D%22_blank%22%3E%40Michael%20Kullish%3C%2FA%3E%26nbsp%3B-%26nbsp%3B%20I've%20gone%20through%20the%20instructions%20several%20times%20and%20checked%20variable%20values%20and%20everything%20seems%20correct%20but%20my%20results%20are%20%22Failed%20to%20aquire%20(sic)%20token%22%20Like%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1205564%22%20target%3D%22_blank%22%3E%40kk212%3C%2FA%3E%26nbsp%3BI%20was%20unsure%20on%20what%20to%20put%20in%20the%20Redirect%20URL%20field.%20If%20this%20is%20indeed%20the%20issue%20could%20you%20please%20elaborate%20on%20that%20step%20of%20the%20instructions%3F%20Looking%20forward%20to%20getting%20this%20working%2C%20thanks%20for%20your%20help.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E*Solved*%3C%2FP%3E%3CP%3ESet%20my%20redirect%20URI%20to%20%3CA%20href%3D%22http%3A%2F%2Flocalhost%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Flocalhost%3C%2FA%3E%26nbsp%3Band%20used%20the%20Directory%20(tenant%20ID)%20from%20the%20AzureAD%20app%20Overview%20blade%20for%20the%20%24Tenantname%20variable%20within%20the%20script.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2992600%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2992600%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F241879%22%20target%3D%22_blank%22%3E%40Michael%20Kullish%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%20Michael%2C%20I%20tried%20to%20execute%20the%20script%20with%20the%20account%20that%20I%20intend%20to%20use%20to%20run%20it%20in%20the%20scheduled%20task%20however%2C%20when%20I%20open%20PowerShell%20under%20that%20account%20and%20execute%20the%20script%2C%20it%20creates%20a%20log%20file%20containing%20only%20few%20accounts.%20No%20email%20is%20triggered.%26nbsp%3B%3C%2FP%3E%3CP%3ENow%20when%20I%20launch%20PowerShell%20as%20admin%2C%20it%20says%20'Failed%20to%20acquire%20token'.%3C%2FP%3E%3CP%3EI%20am%20confused%20as%20to%20how%20should%20I%20run%20the%20script%20manually%20and%20through%20a%20scheduled%20task.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3022533%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3022533%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F241879%22%20target%3D%22_blank%22%3E%40Michael%20Kullish%3C%2FA%3E%26nbsp%3Bin%20our%20environment%2C%20this%20script%20only%20finds%20and%20logs%20couple%20users%2C%20and%20then%20prints%20out%20errors%3A%3CBR%20%2F%3E%3CEM%3EGet-AduserResultantPasswordPolicy%20%3A%20Cannot%20find%20an%20object%20with%20identity%3A%20%5Bname%20of%20one%20FPG%20policy%5D%3C%2FEM%3E%3CBR%20%2F%3E%3CBR%20%2F%3EI%20figured%20out%20that%20piping%20anything%20to%20%3CEM%3Ewhere%3C%2FEM%3E%20will%20cause%20only%20few%20object%20to%20be%20found%20for%20some%20reason.%3C%2FP%3E%3CP%3Eget-aduser%20-filter%20*%20-properties%20Name%2C%20PasswordNeverExpires%2C%20PasswordExpired%2C%20PasswordLastSet%2C%20EmailAddress%20%7C%20%3CSTRONG%3Ewhere%3C%2FSTRONG%3E%20%7B%24_.Enabled%20-eq%20%22True%22%7D%20%7C%20where%20%7B%20%24_.PasswordNeverExpires%20-eq%20%24false%20%7D%20%7C%20where%20%7B%20%24_.passwordexpired%20-eq%20%24false%20%7D%3CBR%20%2F%3EAltering%20the%20line%20to%3A%26nbsp%3B%3CBR%20%2F%3Eget-aduser%20-filter%20%7BEnabled%20-eq%20%24True%20-and%20PasswordNeverExpires%20-eq%20%24False%20-and%20passwordexpired%20-eq%20%24False%7D%20-properties%20Name%2C%20PasswordNeverExpires%2C%20PasswordExpired%2C%20PasswordLastSet%2C%20EmailAddress%3C%2FP%3E%3CP%3EWill%20bring%20up%20right%20results%2C%20but%20cause%20the%20script%20to%20write%20empty%20log%20and%20give%20error%3CEM%3E%26nbsp%3BFailed%20to%20aquire%20token%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3046486%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3046486%22%20slang%3D%22en-US%22%3E%3CP%3EThanks!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20took%20a%20little%20bit%20of%20troubleshooting%20but%20we%20were%20able%20to%20get%20this%20up%20and%20running.%20Our%20only%20suggestion%20would%20be%20to%20flesh%20out%20the%20error%20handling%20instead%20of%20pointing%20all%20errors%20to%20%22Failed%20to%20aquire%20token%22%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3057478%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3057478%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1127814%22%20target%3D%22_blank%22%3E%40rcshoemaker%3C%2FA%3E%26nbsp%3BDo%20you%20mind%20sharing%20what%20you%20had%20to%20do%20to%20get%20it%20working%3F%26nbsp%3B%20We're%20stuck%20at%20%22Failed%20to%20acquire%20token%22.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEdit%3A%20I%20read%20in%20another%20comment%20about%20setting%20redirect%20URL%20to%20%3CA%20href%3D%22http%3A%2F%2Flocalhost%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttp%3A%2F%2Flocalhost%20%3C%2FA%3Eand%20setting%20the%20tenant%20name%20to%20what's%20shown%20in%20the%20app%20registration.%26nbsp%3B%20It%20worked%20once%2C%20but%20then%20Failed%20to%20acquire%20token%22%20again.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3064579%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3064579%22%20slang%3D%22en-US%22%3E%3CP%3EA%20note%20to%20readers%20-%20Follow%20the%20setup%20closely.%26nbsp%3B%20I%20spent%20a%20few%20hours%20attempting%20to%20get%20this%20working%20and%20found%20that%20a%26nbsp%3Byou%20do%20actually%20have%20to%20use%20a%20shared%20mailbox%20specifically.%26nbsp%3B%20It%20was%20failing%20as%20I%20was%20trying%20to%20use%20an%20existing%20user%20mailbox%20and%20it%20did%20not%20work.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3166987%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3166987%22%20slang%3D%22en-US%22%3E%3CP%3EHi!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20found%20this%20article%20and%20script%20which%20is%20exactly%20what%20I%20was%20looking%20for.%3C%2FP%3E%3CP%3EIt%20works%20just%20fine%20except%20I%20can't%20have%20the%20notification%20mail%20sent%20to%20the%20users.%3C%2FP%3E%3CP%3EFor%20testing%20purposes%2C%20I%20set%20the%20script%20with%20testing%20enabled%20and%20adding%20my%20e-mail%20address.%3C%2FP%3E%3CP%3EI%20received%20a%20mail%20with%20the%20information%20required%20AND%20a%20log%20file%20which%20shows%20who%20are%20the%20users%20with%20expiring%20passwords.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20problem%20is%20when%20I%20disabled%20testing%2C%20I%20still%20received%20the%20e-mail%20on%20my%20mailbox%20and%20no%20users%20are%20notified.%20The%20log%20file%20shows%20that%20too.%20Is%20there%20something%20I%20did%20wrong%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20your%20help%20guys.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CU%3EEdit%20Feb.%2021st%2C%202022%3C%2FU%3E%3A%20%3CEM%3EI%20found%20that%20the%20email%20addresses%20in%20the%20user%20accounts%20properties%20were%20not%20set.%20After%20fixing%20this%2C%20the%20script%20ws%20orking%20like%20a%20charm.%26nbsp%3B%3C%2FEM%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3167863%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3167863%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20found%20your%20script%20and%20followed%20it%20thoroughly.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20keep%20getting%20failed%20to%20acquire%26nbsp%3B%20token%20every%20time%20i%20run%20the%20script.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECould%20someone%20please%20point%20me%20to%20what%20i%20am%20doing%20wrong%20thanks%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3192413%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3192413%22%20slang%3D%22en-US%22%3E%3CP%3EHello%26nbsp%3B%3CSPAN%20class%3D%22%22%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F433396%22%20target%3D%22_blank%22%3E%40Oldtrafford345%3C%2FA%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3EDid%20you%20set%20the%20email%20properties%20in%20your%20users'%20accounts%3F%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22DomAnnicette_0-1645440571395.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22DomAnnicette_0-1645440571395.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22DomAnnicette_0-1645440571395.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22DomAnnicette_0-1645440571395.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22DomAnnicette_0-1645440571395.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22DomAnnicette_0-1645440571395.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22DomAnnicette_0-1645440571395.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22DomAnnicette_0-1645440571395.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22DomAnnicette_0-1645440571395.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22DomAnnicette_0-1645440571395.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22DomAnnicette_0-1645440571395.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22DomAnnicette_0-1645440571395.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22DomAnnicette_0-1645440571395.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22DomAnnicette_0-1645440571395.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22DomAnnicette_0-1645440571395.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F349935i7232AC4FE4E48232%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22DomAnnicette_0-1645440571395.png%22%20alt%3D%22DomAnnicette_0-1645440571395.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3224932%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3224932%22%20slang%3D%22en-US%22%3E%3CP%3Ethanks%20managed%20to%20get%20it%20to%20work.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3225074%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3225074%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F433396%22%20target%3D%22_blank%22%3E%40Oldtrafford345%3C%2FA%3E%26nbsp%3Bdid%20you%20open%20the%20powershell%20in%20admin%20mode%20and%20ran%20the%20commands%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ealso%20make%20sure%20that%20the%20tenant%20entered%20in%20the%20script%20is%20correct.%20in%20my%20case%20I%20had%20to%20write%20down%20Email%20address%20removed%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3236556%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3236556%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20been%20working%20with%20this%20script%20for%20a%20few%20days.%26nbsp%3B%20I%20kept%20running%20into%20the%20%22failed%20to%20acquire%20token%22%20wall.%26nbsp%3B%20I%20finally%20copied%20the%20whole%20script%20from%20Github%20into%20a%20new%20window%2C%20updated%20the%20fields%2C%20and%20it%20ran%20without%20error.%26nbsp%3B%20I%20went%20to%20update%20the%20email%20formatting%2C%20and%20now%20I%20have%20run%20into%20the%20%22failed%20to%20acquire%20token%22%20again.%26nbsp%3B%20It%20seems%20that%20the%20only%20way%20I%20have%20gotten%20it%20to%20run%20successfully%20is%20by%20recreating%20the%20script%20each%20time.%26nbsp%3B%20This%20also%20requires%20a%20new%20secret%2C%20new%20app%20registration%2C%20etc.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHas%20anyone%20else%20run%20across%20this%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3238185%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3238185%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F377776%22%20target%3D%22_blank%22%3E%40DomAnnicette%3C%2FA%3E%26nbsp%3Byes%20we%20set%20the%20email%20properties%20in%20the%20account%20for%20our%20users%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1320504%22%20target%3D%22_blank%22%3E%40dijsil%3C%2FA%3E%26nbsp%3BI%20could%20sworn%20i%20tried%20powershell%20as%20admin.%20I%20will%20try%20later%20again%20when%20i%20am%20free%20and%20let%20you%26nbsp%3B%20know%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3239083%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3239083%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20want%20to%20change%20the%20text%20of%20the%20default%20email%20that%20is%20sent%20to%20staff%20when%20notifiying%20them%20they%20need%20to%20change%20their%20password%2C%20any%20ideas%20how%20to%20do%20this%20please%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3239736%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3239736%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F433396%22%20target%3D%22_blank%22%3E%40Oldtrafford345%3C%2FA%3E%26nbsp%3BI%20dont%20know%2C%20I%20was%20getting%20the%20error%20if%20I%20amended%20the%20body%20of%20the%20script.%20Then%20deleted%20all%20settings%2Fscript%20and%20started%20from%20the%20begining%2C%20editied%20the%20script%20body%20before%20generating%20the%20password%20and%20worked.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20spent%20around%2012%20hours%20to%20get%20it%20to%20work%20%3A%5C%3C%2Fimg%3E%20(%20with%20all%20the%20interruptions%20%3Ap%3C%2Fimg%3E%20)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3239739%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3239739%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1005315%22%20target%3D%22_blank%22%3E%40dmannix%3C%2FA%3E%26nbsp%3B%2C%20find%20this%20part%20and%20amend%20as%20needed.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%20%20%20%20%20%20%20%20%20%20%20%20%26lt%3Bp%26gt%3B%20Your%20Password%20will%20expire%20%24(%24messageDays)%26lt%3Bbr%26gt%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20To%20change%20your%20password%20on%20a%20PC%20press%20CTRL%20ALT%20Delete%20and%20choose%20Change%20Password%20%26lt%3Bbr%26gt%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%26lt%3Bp%26gt%3BThanks%2C%20%26lt%3Bbr%26gt%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%26lt%3B%2FP%26gt%3B%22%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3246880%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3246880%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20facing%20the%20same%20problem.%20The%20first%20time%20I%20ran%20the%20script%20it%20correctly%20fired%20the%20emails%2C%20but%20after%20updating%20the%20script%20text%2C%20%22failed%20Token%22%3C%2FP%3E%3CP%3EHas%20anyone%20encountered%20this%20error%20and%20successfully%20resolved%20it%3F%20Redoing%20the%20script%20every%20time%20it%20has%20a%20change%20is%20not%20viable.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3247188%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3247188%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F569834%22%20target%3D%22_blank%22%3E%40robsonrodriguesRHC%3C%2FA%3E%26nbsp%3B%20try%20removing%20the%20password%20file%2C%20edit%20the%20lines%20that%20I%20posted%20in%20my%20previous%20post%20and%20then%20generate%20the%20password%20again.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOnce%20you%20generate%20the%20password%20don't%20amend%20the%20script.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3247741%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3247741%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1320504%22%20target%3D%22_blank%22%3E%40dijsil%3C%2FA%3E%26nbsp%3BI%20have%20removed%20the%20password%20file%2C%20updated%20the%20email%20text%2C%20and%20regenerated%20the%20.ps1.credential%20file%2C%20and%20still%20fails%20to%20acquire%20token.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3248832%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3248832%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1321114%22%20target%3D%22_blank%22%3E%40JasonRichie%3C%2FA%3E%26nbsp%3BI%20dont%20know%20then.%20Mine%20worked%20%3AS%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3249511%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3249511%22%20slang%3D%22en-US%22%3E%3CP%3E%3CFONT%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1320504%22%20target%3D%22_blank%22%3E%40dijsil%3C%2FA%3E%3CFONT%3E%26nbsp%3B%3CFONT%3EEu%20gerei%20nova%20credencial%20depois%20de%20mudar%20o%20texto%2C%20mas%20ainda%20assim%20n%C3%A3o%20funcionou.%3C%2FFONT%3E%3C%2FFONT%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F241879%22%20target%3D%22_blank%22%3E%40Michael%20Kullish%3C%2FA%3E%3C%2FFONT%3E%3CFONT%3E%26nbsp%3B%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%3E%3CFONT%3E%3CFONT%3EVoc%C3%AA%20tem%20outra%20solu%C3%A7%C3%A3o%20para%20este%20caso%20que%20est%C3%A1%20sendo%20levantada%20por%20alguns%20usu%C3%A1rios%20ao%20alterar%20o%20corpo%20da%20mensagem%20e%20executar%20o%20script%3F%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3249589%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3249589%22%20slang%3D%22en-US%22%3E%3CP%3EA%20new%20version%20of%20the%20script%20is%20about%20to%20be%20released%20that%20compensates%20for%20any%20changes.%20I%20expect%20to%20post%20the%20changes%20in%20the%20next%20few%20days%20if%20all%20goes%20well.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3249596%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3249596%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F241879%22%20target%3D%22_blank%22%3E%40Michael%20Kullish%3C%2FA%3E%26nbsp%3B%20looking%20forward%26nbsp%3B%20to%20the%20new%20script%20and%20please%20elaborate%20more%20on%20URL%20token.%20That%20is%20were%20most%20of%20us%20are%20having%20issues%20such%20failed%20to%20acquire%20token%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3249643%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3249643%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F433396%22%20target%3D%22_blank%22%3E%40Oldtrafford345%3C%2FA%3E%26nbsp%3B%2C%20we%20will%20be%20adding%20some%20checks%20in%20the%20script%20to%20be%20more%20descriptive%20and%20alert%20to%20any%20errors%20that%20may%20be%20encountered.%20Hopefully%20it%20will%20be%20a%20bit%20more%20intuitive%20when%20an%20error%20does%20occur.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3256831%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3256831%22%20slang%3D%22en-US%22%3E%3CP%3EExcelent%20solution!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20had%20some%20problems%20to.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMaybe%20help%20somebody%20this%20text.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20first%20mistake%20was%20silly%3A%20in%20the%20API%20permissions%20I%20chose%20Mail.Send%20as%20Delegated%20Permissons.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20other%20error%3A%20in%20the%20Body%20of%20message%2C%20the%20html%20code%2C%20like%20href%2C%20should%20use%20'%20(single%20quotes).%20Any%20error%20in%20html%20message%20break%20the%20script.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20last%2C%20just%20a%20tip%20for%20encoding.%20For%20me%2C%20in%20%22Invoke-RestMethod%22%20the%20%22Content-Type%22%20works%20with%26nbsp%3B'application%2Fjson%3B%20charset%3Dutf-8'%20for%26nbsp%3Bwords%20with%20accents.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3256986%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3256986%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1332971%22%20target%3D%22_blank%22%3E%40DanielFPBSilva%3C%2FA%3E%26nbsp%3BThanks%20for%20the%20input%20and%20contribution.%20I%20am%20sure%20others%20will%20benefit!%20I%20am%20hoping%20we%20will%20have%20an%20updated%20script%20ready%20later%20this%20week%20or%20early%20next%20week%2C%20which%20should%20eliminate%20some%20of%20the%20confusion%20mentioned%20in%20other%20posts%20as%20well.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3265389%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3265389%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F241879%22%20target%3D%22_blank%22%3E%40Michael%20Kullish%3C%2FA%3E%26nbsp%3B-%20Hi%20Michael%2C%20any%20update%20on%20the%20script%20%3F%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3265955%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3265955%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1335339%22%20target%3D%22_blank%22%3E%40Jamie73%3C%2FA%3E%26nbsp%3BThis%20is%20taking%20a%20bit%20longer%20than%20anticipated.%20Dan%20has%20been%20hard%20at%20work%20on%20the%20script%20and%20I%20think%20we%20have%20it%20finalized.%20You%20can%20access%20it%20here%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fdacarroll%2FPWExpireNotification%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EGitHub%20-%20dacarroll%2FPWExpireNotification%3A%20Solution%20to%20send%20password%20expiring%20notifications%20to%20ADDS%20users%20using%20O365%20Mailbox%3C%2FA%3E.%20Use%20the%20Readme.md%20file%20along%20with%20the%20article%20above%20to%20use%20the%20new%20file.%20You%20will%20also%20need%20to%20install%20the%20new%20PoweShell%20module.%20Dan%20will%20be%20making%20this%20public%20very%20soon.%20There%20are%20numerous%20locations%20describing%20how%20to%20manually%20install%20modules%2C%20but%20the%20following%20link%20can%20be%20used%20to%20get%20you%20started%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fscripting%2Fdeveloper%2Fmodule%2Finstalling-a-powershell-module%3Fmsclkid%3D2061c27eab8d11ec8ae7f4041bbe789e%26amp%3Bview%3Dpowershell-7.2%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EInstalling%20a%20PowerShell%20Module%20-%20PowerShell%20%7C%20Microsoft%20Docs%3C%2FA%3E.%20The%20module%20files%20are%20also%20in%20Dan's%20GitHub%20repo.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20hope%20to%20have%20this%20article%20updated%20very%20soon.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3271507%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3271507%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F241879%22%20target%3D%22_blank%22%3E%40Michael%20Kullish%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20all%20for%20your%20efforts%20to%20make%20this%20a%20reality.%20This%20is%20going%20to%20be%20a%20huge%20help%20for%20my%20organization.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20followed%20the%20new%20procedure%20and%20it%20worked%20well%20but%20I%20set%20myself%20up%20as%20the%20test%20recipient%20but%20didn't%20receive%20any%20emails%20for%20those%20employees%20qualify%20for%20the%20number%20of%20days%20I%20entered%20into%20the%20script.%20I%20am%20seeing%20the%20following%20on%20one%20that%20should%20have%20gone%20through%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EInvoke-RestMethod%20%3A%20The%20remote%20server%20returned%20an%20error%3A%20(401)%20Unauthorized.%3C%2FP%3E%3CP%3EAt%20C%3A%5CWindows%5Csystem32%5CWindowsPowerShell%5Cv1.0%5CModules%5CPWExpireNotification-main%5Csrc%5CPWExpireNotification%5C1.0.0%5CFunctions%5CSend-PWExpiringMailMe%3CBR%20%2F%3Essage.ps1%3A91%20char%3A17%3CBR%20%2F%3E%2B%20...%20Invoke-RestMethod%20-Headers%20%40%7BAuthorization%20%3D%20%22Bearer%20%24(%24t%20...%3CBR%20%2F%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3CBR%20%2F%3E%2B%20CategoryInfo%20%3A%20InvalidOperation%3A%20(System.Net.HttpWebRequest%3AHttpWebRequest)%20%5BInvoke-RestMethod%5D%2C%20WebException%3CBR%20%2F%3E%2B%20FullyQualifiedErrorId%20%3A%20WebCmdletWebResponseException%2CMicrosoft.PowerShell.Commands.InvokeRestMethodCommand%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20you%20help%20determine%20why%20I%20would%20be%20getting%20this%20message%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20in%20advance!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3272026%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3272026%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1347991%22%20target%3D%22_blank%22%3E%40NateSanford%3C%2FA%3E%26nbsp%3BThis%20looks%20like%20a%20permissions%20issue.%20I%20would%20start%20by%20checking%20%3CSPAN%3E%E2%80%9CMicrosoft%20Graph%20%E2%80%93%20Mail.Send%E2%80%9D%20permissions.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3272083%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3272083%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F241879%22%20target%3D%22_blank%22%3E%40Michael%20Kullish%3C%2FA%3E%26nbsp%3BYou%20were%20right%2C%20I%20had%20failed%20to%20add%20Application%20Mail.Send%20permissions%20as%20mentioned%20in%20the%20procedure%2C%20but%20now%20that%20it's%20fixed%2C%20I%20am%20still%20getting%20the%20same%20error.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E**UPDATE%3A%20I%20noticed%20in%20the%20instructions%20it%20sais%20the%20set%20the%20SendEmailAccount%20as%20sharedmailbox.domain.com%20vs%20%3CA%20href%3D%22mailto%3AEmail%20address%20removed%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EEmail%20address%20removed%3C%2FA%3E.%20I%20corrected%20this%20issue%20and%20it%20sent%20emails%20to%20me%20in%20test%20most.%20I%20received%20emails%20for%20users%20that%20had%20days%20other%20than%20the%2036%20days.%20Is%20it%20set%20to%20email%20for%20days%20%3D%26gt%3B%20the%20number%20of%20days%20specified%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3272841%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3272841%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1347991%22%20target%3D%22_blank%22%3E%40NateSanford%3C%2FA%3E%26nbsp%3BIt%20sounds%20like%20you%20have%20it%20figured%20out.%20Please%20correct%20me%20if%20I%20am%20wrong.%20I%20tried%20to%20duplicate%20your%20error%20and%20couldn't.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3276620%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3276620%22%20slang%3D%22en-US%22%3E%3CP%3EScript%20and%20instructions%20work%20great%2C%20but%20I%20have%20noticed%20that%20it%20only%20pulls%20expiration%20information%20for%20accounts%20that%20are%20sync'd%20with%20local%20AD.%26nbsp%3B%20I%20don't%20get%20password%20expiration%20information%20for%20any%20of%20my%20Azure%20AD%20only%20accounts.%26nbsp%3B%20Am%20I%20missing%20something%2C%20or%20is%20it%20because%20of%20the%20way%20Azure%20AD%20handles%20password%20expiration%3F%26nbsp%3B%20Any%20way%20to%20notify%20users%20that%20reside%20only%20in%20Azure%20AD%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3276848%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3276848%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1353998%22%20target%3D%22_blank%22%3E%40ABerrySPIPA%3C%2FA%3E%26nbsp%3BThe%20script%20does%20not%20take%20into%20account%20AAD%20only%20accounts.%20As%20you%20mentioned%2C%20Azure%20AD%20handles%20password%20expiration.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3283774%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3283774%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20receiving%20a%20404%20error%20on%20users%20who%20I%20believe%20should%20be%20receiving%20this%20email.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ELooks%20like%20%22New-PWEmailBody%22%20is%20not%20recognized%20could%20be%20a%20problem%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3EVERBOSE%3A%20User%20Account%3A%20%3CFIRST%20last%3D%22%22%3E%2C%20ExpiresOn%3A%205%2F15%2F2022%205%3A29%3A48%20PM%2C%20Days%3A%2033%0AVERBOSE%3A%20EmailAddress%20to%20recieve%20email%3A%20%3CMY%20test%3D%22%22%20email%3D%22%22%3E%0ANew-PWEmailBody%20%3A%20The%20term%20'New-PWEmailBody'%20is%20not%20recognized%20as%20the%20name%20of%20a%20cmdlet%2C%20function%2C%20script%20file%2C%20or%0Aoperable%20program.%20Check%20the%20spelling%20of%20the%20name%2C%20or%20if%20a%20path%20was%20included%2C%20verify%20that%20the%20path%20is%20correct%20and%20try%0Aagain.%0AAt%20C%3A%5CProgram%20Files%5CWindowsPowerShell%5CModules%5CPWExpireNotification%5C1.0.0%5CFunctions%5CSend-PWExpiringMailMessage.ps1%3A76%0Achar%3A17%0A%2B%20%20%20%20%20%20%20%20%20%24body%20%3D%20New-PWEmailBody%20-Subject%20%24subject%20-Importance%20'High'%20%20...%0A%2B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20~~~~~~~~~~~~~~~%0A%20%20%20%20%2B%20CategoryInfo%20%20%20%20%20%20%20%20%20%20%3A%20ObjectNotFound%3A%20(New-PWEmailBody%3AString)%20%5B%5D%2C%20CommandNotFoundException%0A%20%20%20%20%2B%20FullyQualifiedErrorId%20%3A%20CommandNotFoundException%0A%0AVERBOSE%3A%20https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fusers%2Fnoreply.domain.com%2FsendMail%0AVERBOSE%3A%20Using%20Token%3A%0A%3CTOKEN%3E%0AVERBOSE%3A%20Payload%3A%0AVERBOSE%3A%20POST%20https%3A%2F%2Fgraph.microsoft.com%2Fv1.0%2Fusers%2Fnoreply.domain.com%2FsendMail%20with%200-byte%20payload%0AInvoke-RestMethod%20%3A%20The%20remote%20server%20returned%20an%20error%3A%20(404)%20Not%20Found.%0AAt%20C%3A%5CProgram%20Files%5CWindowsPowerShell%5CModules%5CPWExpireNotification%5C1.0.0%5CFunctions%5CSend-PWExpiringMailMessage.ps1%3A91%0Achar%3A17%0A%2B%20...%20%20%20%20%20%20%20%20%20%20%20%20%20Invoke-RestMethod%20-Headers%20%40%7BAuthorization%20%3D%20%22Bearer%20%24(%24t%20...%0A%2B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%0A%20%20%20%20%2B%20CategoryInfo%20%20%20%20%20%20%20%20%20%20%3A%20InvalidOperation%3A%20(System.Net.HttpWebRequest%3AHttpWebRequest)%20%5BInvoke-RestMethod%5D%2C%20WebExc%0A%20%20%20eption%0A%20%20%20%20%2B%20FullyQualifiedErrorId%20%3A%20WebCmdletWebResponseException%2CMicrosoft.PowerShell.Commands.InvokeRestMethodCommand%3C%2FTOKEN%3E%3C%2FMY%3E%3C%2FFIRST%3E%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3283887%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3283887%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1361665%22%20target%3D%22_blank%22%3E%40rmccawley%3C%2FA%3E%26nbsp%3BI%20am%20unable%20to%20duplicate%20this%20error.%20Is%20anyone%20else%20having%20this%20issue%3F%20Were%20you%20able%20to%20successfully%20install%20the%20PS%20module%20from%20the%20PS%20repo%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3283905%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3283905%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F241879%22%20target%3D%22_blank%22%3E%40Michael%20Kullish%3C%2FA%3EThanks%20for%20the%20response.%20It%20does%20look%20like%20it%20installed%20successfully%20from%20the%20repo%2C%20I%20even%20just%20ran%20it%20again.%20It%20just%20returns%20a%20line.%20Is%20there%20anything%20I%20can%20run%20against%20it%20to%20show%20that%20it's%20installed%20correctly%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3284088%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3284088%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1361665%22%20target%3D%22_blank%22%3E%40rmccawley%3C%2FA%3E%26nbsp%3B-%20I%20got%20the%20same%20error%2C%20the%20issue%20is%20the%20function%20%22New-PWEmailBody.ps1%22%20which%20you'll%20find%20here%20-%20%22C%3A%5CProgram%20Files%5CWindowsPowerShell%5CModules%5CPWExpireNotification%5C1.0.0%5CFunctions%22%20is%20missing%20the%20first%20line%20%22function%20New-PWEmailBody%20%7B%22%20and%20a%20closing%20'%7D%22%20at%20the%20end.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Jamie73_1-1649833822346.png%22%20style%3D%22width%3A%20629px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_1-1649833822346.png%22%20style%3D%22width%3A%20629px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_1-1649833822346.png%22%20style%3D%22width%3A%20629px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_1-1649833822346.png%22%20style%3D%22width%3A%20629px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_1-1649833822346.png%22%20style%3D%22width%3A%20629px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_1-1649833822346.png%22%20style%3D%22width%3A%20629px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_1-1649833822346.png%22%20style%3D%22width%3A%20629px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_1-1649833822346.png%22%20style%3D%22width%3A%20629px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_1-1649833822346.png%22%20style%3D%22width%3A%20629px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_1-1649833822346.png%22%20style%3D%22width%3A%20629px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_1-1649833822346.png%22%20style%3D%22width%3A%20629px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_1-1649833822346.png%22%20style%3D%22width%3A%20629px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_1-1649833822346.png%22%20style%3D%22width%3A%20629px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_1-1649833822346.png%22%20style%3D%22width%3A%20629px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_1-1649833822346.png%22%20style%3D%22width%3A%20629px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F363689iB9E4CA2BCD998EA9%2Fimage-dimensions%2F629x275%3Fv%3Dv2%22%20width%3D%22629%22%20height%3D%22275%22%20role%3D%22button%22%20title%3D%22Jamie73_1-1649833822346.png%22%20alt%3D%22Jamie73_1-1649833822346.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EIf%20you%20run%20-%20%3CSTRONG%3EGet-Command%20-Module%20PWExpireNotification%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EYou'll%20see%20you're%20missing%20the%20function%20New-PWEmailBody%2C%20it%20should%20look%20like%20this.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Jamie73_0-1649833646252.png%22%20style%3D%22width%3A%20634px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_0-1649833646252.png%22%20style%3D%22width%3A%20634px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_0-1649833646252.png%22%20style%3D%22width%3A%20634px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_0-1649833646252.png%22%20style%3D%22width%3A%20634px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_0-1649833646252.png%22%20style%3D%22width%3A%20634px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_0-1649833646252.png%22%20style%3D%22width%3A%20634px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_0-1649833646252.png%22%20style%3D%22width%3A%20634px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_0-1649833646252.png%22%20style%3D%22width%3A%20634px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_0-1649833646252.png%22%20style%3D%22width%3A%20634px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_0-1649833646252.png%22%20style%3D%22width%3A%20634px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_0-1649833646252.png%22%20style%3D%22width%3A%20634px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_0-1649833646252.png%22%20style%3D%22width%3A%20634px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_0-1649833646252.png%22%20style%3D%22width%3A%20634px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_0-1649833646252.png%22%20style%3D%22width%3A%20634px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_0-1649833646252.png%22%20style%3D%22width%3A%20634px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F363687iB4E9A33664C7F6EA%2Fimage-dimensions%2F634x149%3Fv%3Dv2%22%20width%3D%22634%22%20height%3D%22149%22%20role%3D%22button%22%20title%3D%22Jamie73_0-1649833646252.png%22%20alt%3D%22Jamie73_0-1649833646252.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3287001%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3287001%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1335339%22%20target%3D%22_blank%22%3E%40Jamie73%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1361665%22%20target%3D%22_blank%22%3E%40rmccawley%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECan%20you%20both%20update%20your%20PS%20module%3F%20There%20was%20an%20issue%20during%20the%20initial%20publish%2C%20and%20this%20item%20should%20be%20remedied.%20Sorry%20for%20the%20delay%20in%20response.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3290500%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3290500%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20my%20teacher%2C%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20sharing.%20We%20are%20starting%20to%20develop%20our%20new%20processes%20with%20the%20Microsoft%20Graph.%20I%20have%20a%20question.%3C%2FP%3E%3CP%3E*%20When%20we%20send%20mail%20to%20users%20via%20Microsoft%20Graph%20Send%20mail%20(let's%20assume%20that%2050%20or%2080%20users%20will%20be%20sent%20consecutive%20mail%20in%201%20day).%20Will%20we%20be%20blacklisted%3F%3C%2FP%3E%3CP%3EIf%20we%20are%20in%20a%20blacklist%20situation%2C%20can%20we%20include%20a%20waiting%20time%20in%20Scpirt%20based%20on%20minutes%20in%20sending%20mail%20to%20each%20user%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ethanks%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3290611%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3290611%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1368688%22%20target%3D%22_blank%22%3E%40Ozan0667%3C%2FA%3E%26nbsp%3B%2C%20you%20should%20not%20be%20blacklisted%20since%20this%20is%20all%20be%20sent%20to%20internal%20organization%20members.%20I%20have%20not%20personally%20heard%20of%20anyone%20being%20blacklisted%20for%20this%20practice.%20Currently%20the%20script%20and%20PowerShell%20modules%20do%20not%20accommodate%20for%20time%20delays%20in%20sending%20the%20email.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3296483%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3296483%22%20slang%3D%22en-US%22%3E%3CP%3Efolks%2C%20good%20afternoon!%3C%2FP%3E%3CP%3EThe%20script%20works%20perfectly%20when%20I%20run%20it%20manually%2C%20but%20I%20want%20to%20create%20a%20scheduled%20task%20to%20automate%20the%20execution%20daily.%20The%20problem%20is%20that%20the%20task%20runs%20correctly%2C%20but%20does%20not%20run%20the%20script.%20Has%20anyone%20had%20this%20problem%20and%20can%20help%20me%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3297032%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3297032%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20having%20the%20same%20problem%20as%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1374927%22%20target%3D%22_blank%22%3E%40carlos_petrosino%3C%2FA%3E.%20I%20can%20run%20it%20manually%20with%20no%20problem%2C%20if%20I%20schedule%20it%20using%20the%20same%20account%20to%20run%20it%20per%20the%20instructions%2C%20it%20fails%20to%20execute%20the%20script.%20I%20also%20tried%20to%20run%20it%20using%20a%20batch%20file%20and%20had%20the%20same%20problem%20where%20it%20never%20actually%20runs.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3297567%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3297567%22%20slang%3D%22en-US%22%3E%3CP%3ESame%20issue%20here.%20I'm%20not%20able%20to%20set%20a%20scheduled%20task%20running%20it%20on%20a%20bi-weekly%20basis%20for%20example.%20Anyone%20did%20succeed%20to%20make%20it%20work%3F%3C%2FP%3E%3CP%3EThanks.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3322623%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3322623%22%20slang%3D%22en-US%22%3E%3CP%3EFirst%20off%2C%20thank%20you%20for%20building%20this!%26nbsp%3B%20This%20has%20been%20a%20life%20saver.%26nbsp%3B%20I%20was%20wondering%20if%20anyone%20has%20had%20success%20in%20modifying%20the%20body%20of%20the%20email%20to%20not%20appear%20as%20%22phishy%22.%26nbsp%3B%20I%20wanted%20to%20add%20some%20HTML%20formatting%20but%20it%20doesn't%20appear%20to%20read%20it%20as%20such.%20I%20tried%20the%20single%20quotes%20and%20adding%20an%20%3CA%3E%20tag%20for%20a%20link%20to%20the%20password%20reset%20link%20from%20Microsoft.%26nbsp%3B%20Thank%20you%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3333750%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3333750%22%20slang%3D%22en-US%22%3E%3CP%3EI%20love%20this%20solution%20but%20I%20have%20to%20say%2C%20%22Send%20mail%20as%20%3CSTRONG%3Eany%3C%2FSTRONG%3E%20user%22%20scares%20the%20crap%20out%20of%20me.%20Anyone%20implementing%20this%20should%20at%20the%20very%20least%20restrict%20the%20app%20to%20only%20allow%20it%20to%20send%20messages%20from%20one%20specific%20account%20that%20isn't%20used%20for%20anything%20else.%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fauth-limit-mailbox-access%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fgraph%2Fauth-limit-mailbox-access%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'll%20be%20testing%20if%20I%20can%20get%20this%20to%20work%20without%20interaction%20with%20delegated%20permissions%20but%20for%20now%20I%20would%20recommend%20anyone%20implementing%20this%20uses%20the%20above%20linked%20solution.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3350052%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3350052%22%20slang%3D%22en-US%22%3E%3CP%3EDear%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F241879%22%20target%3D%22_blank%22%3E%40Michael%20Kullish%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20from%20Hungary%2C%20and%20we%20would%20like%20to%20use%20your%20script%20which%20is%20fantastic!%3C%2FP%3E%3CP%3EHoweverm%20can%20you%20tell%20me%20where%20can%20I%20modify%20the%20message%20and%20character%20coding%3F%20As%20you%20can%20see%20there%20are%20some%20characters%20like%20%22%C3%A9%2C%20%C3%A1%22%20etc%20which%20can%20not%20show%20correctly.%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22csabaoszlanszky_0-1652179817080.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22csabaoszlanszky_0-1652179817080.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22csabaoszlanszky_0-1652179817080.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22csabaoszlanszky_0-1652179817080.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22csabaoszlanszky_0-1652179817080.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22csabaoszlanszky_0-1652179817080.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22csabaoszlanszky_0-1652179817080.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22csabaoszlanszky_0-1652179817080.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22csabaoszlanszky_0-1652179817080.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22csabaoszlanszky_0-1652179817080.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22csabaoszlanszky_0-1652179817080.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22csabaoszlanszky_0-1652179817080.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22csabaoszlanszky_0-1652179817080.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22csabaoszlanszky_0-1652179817080.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22csabaoszlanszky_0-1652179817080.png%22%20style%3D%22width%3A%20360px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F370452iCD6FA134E2198459%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22csabaoszlanszky_0-1652179817080.png%22%20alt%3D%22csabaoszlanszky_0-1652179817080.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EThanks%2C%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3357249%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3357249%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1385784%22%20target%3D%22_blank%22%3E%40csabaoszlanszky%3C%2FA%3E%26nbsp%3BWould%20you%20mind%20filing%20an%20issue%20within%20the%20GitHub%20repo%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fnam06.safelinks.protection.outlook.com%2F%3Furl%3Dhttps%253A%252F%252Fgithub.com%252Fdacarroll%252FPWExpireNotification%252Fissues%26amp%3Bdata%3D05%257C01%257CMichael.Kullish%2540microsoft.com%257C013ff6037328414b0b8b08da32dc1e30%257C72f988bf86f141af91ab2d7cd011db47%257C1%257C0%257C637878218243441362%257CUnknown%257CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%253D%257C3000%257C%257C%257C%26amp%3Bsdata%3DlYtl08rf7xcSaRShCdvj0R1YW5lB%252FIz2wUb4242oy1o%253D%26amp%3Breserved%3D0%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EIssues%20%C2%B7%20dacarroll%2FPWExpireNotification%20(github.com)%3C%2FA%3E.%20We%20never%20considered%20this%20would%20get%20as%20much%20attention%20as%20it%20is%20and%20localization%20of%20the%20PS%20module%20wasn't%20originally%20considered.%20Dan%20has%20a%20backlog%20of%20items%20and%20putting%20in%20the%20issue%20request%20will%20help%20prioritize%20getting%20this%20entered.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThank%20you%20everyone%20for%20making%20this%20solution%20better!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3357427%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3357427%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F241879%22%20target%3D%22_blank%22%3E%40Michael%20Kullish%3C%2FA%3E%26nbsp%3BThanks%20for%20your%20answer%2C%20I%20filled%20an%20issue.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3360231%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3360231%22%20slang%3D%22en-US%22%3E%3CP%3EHas%20anyone%20been%20able%20to%20get%20the%20task%20schedule%20to%20work%3F%26nbsp%3B%20I've%20tried%20the%20regular%20means%20of%20setting%20it%20up%20and%20now%20I've%20tried%20the%20register-schedulejob%20and%20it%20reflects%20the%20same%20result.%20Windows%20says%20it%20runs%20successfully%20but%20no%20emails%20come%20through.%26nbsp%3B%20The%20script%20runs%20fine%20on%20it's%20own.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3360299%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3360299%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F823834%22%20target%3D%22_blank%22%3E%40techdude44%3C%2FA%3E%26nbsp%3B-%20I%20was%20able%20to%20get%20the%20scheduling%20working%20using%20a%20batch%20file.%20I%20just%20put%26nbsp%3BC%3A%5CWindows%5CSystem32%5CWindowsPowerShell%5Cv1.0%5Cpowershell.exe%20-File%20%22C%3A%5CPW_ResetNotificationScript_DO_NOT_DELETE%5CPasswordChangeNotificationO365.ps1%22%20in%20a%20batch%20file%20and%20executed%20that.%20Obviously%20the%20file%20path%20would%20need%20to%20be%20changed%20but%20it%20worked%20flawlessly.%20One%20thing%20worth%20noting%20is%20I%20also%20had%20to%20put%20the%20folder%20path%20(C%3A%5CPW_ResetNotificationScript_DO_NOT_DELETE%5C)%20in%20the%20%22start%20in%22%20field%20of%20the%20scheduled%20task.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3427334%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3427334%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1375200%22%20target%3D%22_blank%22%3E%40jdbmnc%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1374927%22%20target%3D%22_blank%22%3E%40carlos_petrosino%3C%2FA%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3EI%20finally%20made%20it%20work%20using%20the%20following%20article%3A%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fo365reports.com%2F2019%2F08%2F02%2Fschedule-powershell-script-task-scheduler%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EHow%20to%20Schedule%20PowerShell%20Script%20Using%20Task%20Scheduler%20(o365reports.com)%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20tried%20it%20already%20and%20gave%20it%20another%20try%20yesterday.%20I%20was%20able%20to%20run%20the%20scheduled%20task%20manually%20AND%20to%20have%20it%20run%20automatically%20(this%20morning's%20result%20was%20good%20for%20me).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHTH.%3C%2FP%3E%3CP%3EDom%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3427544%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3427544%22%20slang%3D%22en-US%22%3E%3CP%3EDear%3C%2FP%3E%3CP%3EWhen%20everything%20has%20been%20done%20just%20like%20article%20says%3A%20if%20You%20need%20to%20change%20anything%20in%20the%20script%2C%20use%26nbsp%3BWindows%20PowerShell%26nbsp%3BIntegrated%20Scripting%20Environment%20(ISE)%20to%20edit%20and%20regular%20Powershell%20to%20run%20it.%20Then%20You%20wil%20not%20have%20to%20re-register%20the%20app.%20Also%20for%20those%20of%20us%20living%20in%20countries%20with%20non-US%20characters%2C%20use%20this%3A%26nbsp%3B%26nbsp%3B'application%2Fjson%3Bcharset%3DUTF-8'%20at%20line%20155.%3C%2FP%3E%3CP%3EOld%20version%20of%20the%20script%20works%20fine%20and%20also%20scheduled%20task%20works%20perfect.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBest%20regards%3C%2FP%3E%3CP%3EErik%20S-H%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3430944%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3430944%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20having%20a%20problem%20trying%20to%20get%20it%20to%20run%20without%20a%20test%20email%20address.%20It%20works%20fine%20when%20I%20put%20in%20my%20email%20address%20but%20when%20I%20remove%20it%20I%20get%20an%20error%20saying%20%22No%20email%20address%22%20%3F%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Jamie73_0-1653521625066.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_0-1653521625066.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_0-1653521625066.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F375306iA4FA1F2C8E40E0EA%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Jamie73_0-1653521625066.png%22%20alt%3D%22Jamie73_0-1653521625066.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Jamie73_1-1653523226376.png%22%20style%3D%22width%3A%20796px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_1-1653523226376.png%22%20style%3D%22width%3A%20796px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Jamie73_1-1653523226376.png%22%20style%3D%22width%3A%20796px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F375312iB2365DB2901CA4B3%2Fimage-dimensions%2F796x134%3Fv%3Dv2%22%20width%3D%22796%22%20height%3D%22134%22%20role%3D%22button%22%20title%3D%22Jamie73_1-1653523226376.png%22%20alt%3D%22Jamie73_1-1653523226376.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20ideas%20%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EUpdate%3A%3C%2FSTRONG%3E%20I've%20managed%20to%20get%20it%20working%20by%20filtering%20out%20the%20accounts%20with%20%24%20at%20the%20end.%20I%20just%20added%20a%20-SearchBase%20to%20Get-ADUser%20in%20the%20file%20C%3A%5CUsers%5C%25username%25%5CDocuments%5CWindowsPowerShell%5CModules%5CPWExpireNotification%5C1.0.1%5CFunctions%5CGet-PWADDSExpiringPassword.ps1%20to%20exclude%20the%20OU%20with%20the%20user%24%20accounts.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3440018%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20365%20Password%20Expiration%20Notification%20Email%20Solution%20for%20On-Premises%20AD%20Accounts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3440018%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20class%3D%22%22%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F377776%22%20target%3D%22_self%22%3E%3CSPAN%20class%3D%22%22%3E%3CFONT%3EDomAnnicette%3C%2FFONT%3E%3C%2FSPAN%3E%3C%2FA%3E%26nbsp%3BI%20did%20exactly%20as%20the%20article%2C%20but%20it%20didn't%20work...%20I%20don't%20know%20what%20else%20to%20do%2C%20can%20you%20help%20me%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E
Co-Authors
Version history
Last update:
‎Sep 30 2021 05:46 AM
Updated by: