Random Password Function Powershell

To generate a random password for Active directory you can use this function Function Get-RandomPassword(){ Param ( [int]$length=5 ) $alphabet=$NULL;For ($a=65;$a –le 90;$a++) {$alphabet+=,[char][byte]$a } $ascii=$NULL;For ($a=33;$a –le 126;$a++) {$ascii+=,[char][byte]$a } For ($l=1; $l -le $length; $l++){ $tempPassword += ($alphabet | Get-Random) $tempPassword += ($ascii | Get-Random) } return $tempPassword }   Even though the… Read More

Advertisements

Emailing Users when Password is about to Expire

I had one request from a customer recently that asked if it was possible to email users before the their active directory passwords expire as it was causing issues with remote users. I created a PowerShell script which I added as a scheduled task on one domain controller that runs once  a day. The script… Read More