Skip to content

Instantly share code, notes, and snippets.

@JacobErnst98
Created March 2, 2020 15:55
Show Gist options
  • Save JacobErnst98/69598d3f686c98a8777b3bed00000df6 to your computer and use it in GitHub Desktop.
Save JacobErnst98/69598d3f686c98a8777b3bed00000df6 to your computer and use it in GitHub Desktop.
Reset a local ad password from the rest value given in office 365, for environments not running azure ad sync
Connect-MsolService
$people = "<sam1>,<sam2>"
$domain = "<@website.com>"
foreach($person in $people){
$tmpPass = Set-MsolUserPassword -UserPrincipalName $($person + $domain)
Set-ADAccountPassword -Identity $person -Reset -NewPassword (ConvertTo-SecureString -AsPlainText $tmpPass -Force)
Add-ADGroupMember -Identity "E2" -Members $person
Write-Host $person "---Password---" $tmpPass
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment