[Redirect] New-PasswordReminder.ps1 v2.2 – Target Specific OUs, Better Password Policy Info, Code Tweaks
Here’s the latest version of the script. For information on previous builds, including installation instructions, please see New-PasswordReminder.ps1 v2.1 – updated to include better formatting, preview, and installer!
Issues resolved:
- added some missing ‘alt’ tags for some images in email HTML code
- added $HelpDeskURL variable in param block. That resolves the problem of some links that weren’t clickable (whoops!)
- updated links to point to new blog. This includes the one in the event log message.
#2 is the only one that you need to worry about. Line 166 defines a URL for your Help Desk:
[parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Mandatory=$false)] [ValidatePattern("^http")] [string]$HelpDeskURL = https://intranet.contoso.com/,
New features/additions
- added code to determine global minimum password length & format message accordingly
- added code to determine global password complexity requirements & format message accordingly
- added some parameter validation
- added ability to target a single OU, and its children
- updated the Send-MailMessage line based on user feedback
#1 and #2 are quite similar. The script now looks at the default domain password policy and retrieves the minimum password length and complexity requirements. It then uses this info to formulate the text for the email. In previous versions of the script, the HTML code had to be set manually.
#3 is just to make sure valid info is passed to some of the parameters.
#4. This was a reader request. To target a specific OU, set the OU in the param block. Look at line 185
[parameter(ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $false, Mandatory = $false, HelpMessage = "Please specify an Organizational Unit")] [ValidateNotNullOrEmpty()] [string] $ou
And set $ou to the full name of the OU, such as
[parameter(ValueFromPipeline = $false, ValueFromPipelineByPropertyName = $false, Mandatory = $false, HelpMessage = "Please specify an Organizational Unit")] [ValidateNotNullOrEmpty()] [string] $ou = "ou=myusers,dc=contoso,dc=com"
The script will only check user accounts in that OU, and ALL CHILD OUs.
#5 was done to improve performance, but also get around an issue that was reported by a reader. Two issues resolved at once!
Download the new version at New-PasswordReminder.zip and keep those comments coming!
Follow Me