#Change Parent Password Script function reset-password {

$pws = @("Password1", "Password2", "Password3", "Password4","Password5", "Password6", "Password7")
$When = ((Get-Date).AddDays(-30)).Date
Get-ADUser -filter {whenCreated -ge $When} -replacebase "OU=Users,OU=Managed Users,DC=Domain,DC=Controller" -properties DisplayName,WhenCreated  |  %{
 $newpw = get-random $pws
 $user = $\_.name
$DisName = $\_.DisplayName
 Set-ADAccountPassword -Reset -Identity $user -NewPassword $(convertto-securestring -asplaintext -force $newpw)
 "$user,$newpw,$DisName"
} }
reset-password add-content parents.txt