Bulk Change Passwords of O365 users

Modified on Tue, 30 Jun at 3:12 PM

Import-Csv "C:\temp\changepass.csv" -Delimiter "," -Encoding UTF8 | ForEach-Object {

        $user = Get-AzureADUser -Filter "userPrincipalName eq '$($_.upn)'"

        $secureString = ConvertTo-SecureString ($_.pw) -AsPlainText -Force

        Set-AzureADUserPassword -ObjectId $user.ObjectID -Password $secureString -ForceChangePasswordNextLogin $true

    }

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article