Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $credential = Get-Credential
- Import-Module MsOnline
- Connect-MSolService -Credential $credential
- $NewPassword = Read-Host -Prompt "What is the new Password you would like to use?"
- $Username = <Insert Username with @ at the end - i.e. admin@)>
- $AllTenants = Get-MsolPartnerContract -All
- $ClientDomains = $AllTenants | foreach {$TenantID = $_.TenantId; $Domain = Get-MsolDomain -TenantId $TenantID |
- Where-Object {($_.Status -eq "Verified") -and ($_.Name -notlike "*.onmicrosoft.com") -and ($_.isdefault -eq "True")}
- foreach-object {$EmailAddress = $Username + $Domain.name
- ForEach-Object {Write-Host "The password for $EmailAddress was changed successfully!"
- }
- }
- Set-MsolUserPassword -TenantId $TenantID -UserPrincipalName $EmailAddress -NewPassword $NewPassword -ForceChangePassword $false
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement