Resetting the password for multiple user accounts

Often, Windows administrators get requests to reset the password for a bunch of users. You can do this via a GUI approach if you have the time and patience. Otherwise, use the following function, which is an efficient way to do this. This function prompts for the password that you want to set for the users. This password should match the password complexity policy of your domain. You can pass the list of users to the UserName parameter either as a Comma-Separated Value or by reading from a text file:

Function Reset-ADuserPassword { [CmdletBinding()] Param( [string[]]$UserName ) $Password = Read-Host "Enter the password that you want to set for the users" -AsSecureString foreach($User in $UserName) ...

Get Active Directory with PowerShell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.