Sign up for Office 365
Learn more about Office 365
The Grid is full of Office 365 experts that are brimming with great information. The Grid User Post blog series will expose some of The Grid's best content to the entire Office 365 Community. Are you interested in contributing to The Grid? Click here to apply.
Out latest Grid user post comes from Martina Grom. View the original post here. (may link to a third-party site)
Office 365 has a password policy, which is by default set to expire on a regular basis (90 days). There are some guidelines which help to make sure that the password is secure:
Each user is able to change his password at any time. If a user forgets his password it can be reset by an Office 365 administrator.
In some cases – for example for service accounts – it is useful to change the password expiration policy to never expire.
In this post I will show you how you can disable the password expiration for Office 365 and for BPOS as well.
In office 365 you need only two lines to disable the password policy. First open the Microsoft Online Services Modul for Windows Powershell. (Download: 32bit or 64bit).
Connect to Office 365
In the dialog enter the credentials of an administrator:
To change a single user:
Set-MsolUser -UserPrincipalName <username> -PasswordNeverExpires $True
To change all users at once:
Get-MsolUser | Set-MsolUser -PasswordNeverExpires $True
That’s it. You can control the result with the following command:
Get-MsolUser | fl
You can also change the password policy for former BPOS accounts. Here we use a csv-File, which contains all enabled users: First of all you need PowerShell for Migration (Download 32bit and 64bit).
Our first step is to export all users to a csv-File.
$Cred = Get-Credential
Get-MSOnlineUser -Credential $Cred -Enabled | select-object -property Identity | export-csv C:\data\user.csv
Now you find a csv-File with your enabled BPOS Users.
Our Script looks like that:
$Cred = Get-Credential
$Users = Import-Csv -Path "C:\data\user.csv"
ForEach($User in $Users)
Set-MSOnlineUserPasswordNeverExpire –Identity $User.Identity –PasswordNeverExpire $true –Credential $Cred
Save the script as disableexpire.ps1 in the same directory as your user.csv file.
In PowerShell start the script with this command:
This is the result:
All user account expiration settings have been changed.
Please be aware that it is – for security reasons – a good idea to change your passwords frequently!