PowerShell script to send reminder email about password expiration

Here is the link for the script I am using for email notification regard password expiration (Version 2.0).

The script is wrote in powershell.

It is can be run from command line like schedule task: “C:WindowsSystem32WindowsPowerShellv1.0powershell.exe -command C:ScheduleTasksactive_directory_expiration.ps1”

Download the Script and rename the suffix from .txt to .ps1


On the first section you need to feel relevant data for your domain and you server it runs from it (change the brackets to relevant data, NO NEED BRACKETS!!!):

	$domainsuf = "@[domin.com]"
	$logpath = "[C:ScheduleTasksLogs]"
	$smtpsrv = "[SMTPSERVER]"
	$SearchBase1 = "[OU=Sales,DC=Domain,DC=com]"
	$SearchBase2 = "[CN=Users,DC=Domain,DC=com]"
	$LogFile = $logpath + "[expired_log.csv]"
	$Domain = "[NetBios Domain Name]"







I will be glade to get suggestions…



One thought on “PowerShell script to send reminder email about password expiration”

  1. Hi Mike, first thanks for the work aruond , still dont understand why Microsoft didnt change it , because your are able to select domain local security groups when grant send-as permissions.But i got a small other issue with exchange 2010, i am using the domain local security group to set grant permissions to a shared mailbox. for a unknow reason the attribute msExchDelegateListLink of the shared mailbox does not get filled in. so users who are member of that group does not get the shared mailbox automatically in their outlook 2010. if i add the permissions per user the attribute get filledin within a few minutes and trhe users sees the shared mailbox in their outlook after 3 min. any help is greatley appriciated

Leave a Reply

Your email address will not be published. Required fields are marked *