Change All Your Demo Users Passwords

Matthew McDermott

by Matthew McDermott on 10/1/2015

Share this:

Article Details

Date Revised:

Applies to:
demos, Office 365, passwords, PowerShell

I am so excited to be speaking at Unity Connect Amsterdam 2015! BTW, you get a discount if you register with “McDer10″. I am getting my content together for my session, Managing Office 365 with PowerShell and thought I’d share a tip that saves me TONS of times when working with a new demo tenant. With a little tweak, I know this can be used in production too; more about that at the end.

Change All Your Demo Users Passwords

I use Microsoft Office Demos for my Office 365 demo sites because I get a fully fleshed out demo for 90 days. When that expires, I set up a new one. When the provisioning completes I get an email with the “default password”, but if anyone in the audience knows this process (and they are evil and mean spirited), they can do terrible things to me and my demo. When I login for the first time as the Administrator I change the password, but I needed a quick way to change the passwords for the 25 accounts that are created. Here is my script. You should only have to edit the $adminuser and $newpassword variables. Then run the script in the Windows PowerShell or Windows Azure Active Directory Module for Windows PowerShell.

#Get the administrator user account

$adminuser = “[email protected]”

#Get the NEW password for your users

$newpasswd = “[email protected]″


# This will pop-up a dialog and request your password

$cred = Get-Credential -Credential $adminuser


#——– Import the Local Microsoft Online PowerShell Module Cmdlets and Connect to O365 Online ———–

Import-Module MSOnline

Connect-MsolService -Credential $cred


#Enumerate all users except Administrator

Get-MsolUser | Where-Object {$_.UserPrincipalName -ine $adminuser} | foreach{

#Set their Password to something known

Write-Host “Setting:” $_.UserPrincipalName

Set-MsolUserPassword –UserPrincipalName $_.UserPrincipalName –NewPassword $newpasswd -ForceChangePassword $false | Out-Null


What About Production?

I suppose there could come a day when you actually need to change all the user passwords. Like, if you are running the Office 365 site for Ashley Madison. In that case, just change “-ForceChangePassword $false” to $true. When your users login with new the $newpasswd they will be prompted to change their password.

I’d love to see you in Amsterdam! Remember the discount code!

You can find Matt's original article and blog here:

Topic: PowerShell

Sign in with

Or register