Home > Office 365, Tips & Tricks > Office 365 Password Expiration Policy

Office 365 Password Expiration Policy

I recently purchased an Office 365 account and wanted to set the Password Expiration policy to never expire.  I understand that is not necessarily a recommend practice but given the particulars of my scenario, it was ok.

The good news is that it only took about 10 minutes for me to make the change. Having said that, I’ve seen several community posts from people who have struggled with this so I thought I would post the steps:

All of the information you need to set the Password Expiration policy to Never Expire can be found in these articles:

Manage Azure AD using Windows PowerShell

Configure user passwords to never expire

One important step is to ensure you meet the software requirements.  So the first step is to select Review software requirements.  It is important to ensure you have the the correct Microsoft Online Services version.  If you don’t have the right version, you will receive an error when you attempt to install Windows Azure AD Module.  You will need Microsoft Online Services Sign-In Assistant for IT Professionals RTW for the AD Module to work.

One you have Microsoft Online Services Sign-In Assistant for IT Professionals RTW installed and assuming you have a supported Operating System (Windows 7, Windows 8, Windows Server 2008 R2, or Windows Server 2012 with the default version of Microsoft .NET Framework and Windows PowerShell).  You should be able to proceed with the Windows Azure AD Module installation.  You have two options:

 

Select the option that matches your machine.  When the install completes, select the option to save a Windows Azure Active Directory Module for Windows shortcut on your desktop.  This will make it easy to complete the remaining steps.

After the install completes, select the Windows Azure Active Directory Module for Windows PowerShell application from your desktop to open it.

 

image

Next we are going to follow the steps outlined in the article Manage Azure AD using Windows PowerShell

The first step is connect to your online service.  You have a couple of choices.  Either enter the following command at the prompt:

connect-msolservice

Or enter:

$msolcred = get-credential

connect-msolservice -credential $msolcred

For this example, I selected the second option.  You can copy and paste the commands by selecting the Powershell icon from the open program and select edit:

image

After entering the command, a credential prompt will open. Here you will enter your Office 365 login credentials and select Ok.

image

At this point, you are connected and can run the password policy scripts.  In this example, I am setting the Password Expiration policy for the Office 365 Organization.  If you want to set the policy at the user level, then you can follow those instructions as provided in the article.

The first script I will run is to set the password expiration policy to Never Expire for all users in the organization.  If you prefer, you can follow the sequence in the article by first checking to see what password expiration policy is set for an individual user or everyone in the organization.  I plan to take that step last because I know what policy is currently set.

Since I want to set the policy for all users in the organization, I will run the following script:

Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $true

image

Select Enter on your keyboard and the script will complete

Next I will run the script to check the password policy for all users to ensure it was set as expected:

Get-MSOLUser | Select UserPrincipalName, PasswordNeverExpires

After selecting Enter, I can see that the PasswordNeverExpires is set to True for all users as expected:

O365PowerShell_SC 4.14

That is all you need to do to set the Online Service account password for your organization to never expire.

In the event you didn’t notice it in the article, I suggest running the scripts to create a help file and save that to your desktop.  To take that action simply run the following commands and a text file will open that you can save.

new-item c:\MSOLHelp -type directory get-command | Where-Object {$_.name -like “*msol*”} | format-list | Out-File c:\MSOLHelp\msolcmdlets.txt notepad c:\MSOLHelp\msolcmdlets.txt

 

image

Have fun exploring the other things you can do with PowerShell scripts & Office 365.

Cheers

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 2,661 other followers

%d bloggers like this: