The Set-MsolPasswordPolicy cmdlet in PowerShell updates the password policy of a specified domain in Microsoft Office 365. This command requires the root domain to set the password policy, validity period, and notification days.
The syntax to update the password policy for a domain in Office 365 is given below.
Set-MsolPasswordPolicy -DomainName <String> -ValidityPeriod <UInt32> -NotificationDays <UInt32> [-TenantId <Guid>] [<CommonParameters>]
In this article, we will discuss how to use the Set-MsolPasswordPolicy cmdlet in PowerShell to update the password policy for the domain in Office 365.
How to Update the Password Policy for a Domain in Office 365
To update the password policy for a domain in Office 365, use the Set-MsolPasswordPolicy cmdlet in PowerShell.
The Set-MsolPasswordPolicy command uses the
-ValidityPeriod parameter to specify the length of time that a password remains valid before it must be changed. The
-NotificationDays parameter specifies the number of days before the password expiration date that will trigger when users will receive their first notification that their password will soon expire.
Set-MsolPasswordPolicy -ValidityPeriod 60 -NotificationDays 14 -DomainName "shellgeek.com"
This command updates the policy for the domain “shellgeek.com” so that the user’s password expires after 60 days. The users will receive a notification 14 days before that expiry.
I hope the above article on how to update the password policy on the domain using the Set-MsolPasswordPolicy cmdlet in PowerShell is helpful to you.
You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.