# Setting the parameters Param ( [Parameter(Mandatory=$true)] [string]$Username ) # # Import the tools to work with AD. # Import-Module ActiveDirectory # # Disabled, exprire then reset password the account # Disable-ADAccount -Identity $Username Set-ADAccountExpiration -Identity $Username -DateTime "11/12/2011" Set-ADAccountPassword -Identity $Username -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "newpassword" -Force)