Created
March 2, 2020 15:55
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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