Powershell – Email reset password in Office365 using powershell

microsoft-office-365powershell

When I reset a password in the Office 365 Admin portal, I have the option to send the new password in an email, without me even seeing the password first.

enter image description here

I know I can reset the password with

Set-MsolUserPassword

Can I also trigger the password email to an email address of my choice from Powershell – like in the UI? If yes, how?

Best Answer

One tweak to Mike111b's email:

You could simply use:

$Password = Set-MsolUserPassword -UserPrincipalName <UPN>

Then use the Send-MailMessage command.

The Set-MsolUserPassword command returns the password as an output so it can be saved to a variable.