This script will retrieve Applied Password Policy status from endpoint under Group policy as a report and sends the report to the preferred mail address.
This script will very that the system has applied policies with following configurations. If not it will throw an alert and show actual configurations :
Give the receiver email address,sender email address and sender app password
Sender = "xxx@gmail.com" ## Provide the From Email address from which the mail to be send
Password = "pgihmssgyguhhhhd" ##Provide the 16 digit app password for sender email
emailto= "xxx@yyy.com" ## receiver email address
NOTE:
1.Run the script as Local System user
2. Enable 2 factor authentication for sender email address from that account
3. Create app password for sender email address which you have to provide in the script.