Move Disabled users in disabled OU with email alert PowerShell script

preview_player
Показать описание
This script is written in PowerShell and is designed to move disabled users in Active Directory to a specified OU and send an HTML email report with details of the users moved.

The script first sets the target OU where disabled users will be moved and retrieves all disabled users except krbtgt and guest accounts from the specified search base. It then separates the already disabled users in the target OU from the new disabled users that need to be moved.

Next, the script prepares an HTML email report that includes two tables: one for users already in the target OU and another for users moved to the target OU. The report includes details such as the name, SAM account name, and email address of each user.

Finally, the script sends the email report using the Send-MailMessage cmdlet with the specified parameters, including the SMTP server, port, SSL, credentials, recipient, sender, subject, body, and body format.

You can find the complete PowerShell script on below link.
Рекомендации по теме