Home » Office 365 » Get-MsolPasswordPolicy

Get-MsolPasswordPolicy

The Get-MsolPasswordPolicy command in PowerShell gets the current password policy for a tenant or a domain in Microsoft Office 365. This command gets the password expiry notification days and validity period for a tenant or a specified domain.

The syntax to get the values associated with the Password Expiry in Office 365 is given below.

Get-MsolPasswordPolicy
   -DomainName <String>
   [-TenantId <Guid>]
   [<CommonParameters>]

In this article, we will discuss how to use the Get-MsolPasswordPolicy cmdlet in PowerShell to get the password expiry for the domain in Office 365.

How to Get the Password Policy for a Domain in Office 365

To get the password policy for a domain in Office 365, use the Get-MsolPasswordPolicy cmdlet with the -DomainName parameter. The -DomainName parameter specifies the fully qualified domain name of the domain to be retrieved.

Get-MsolPasswordPolicy -DomainName "shellgeeklab.onmicrosoft.com"   

This command gets the password policy for the domain “shellgeeklab.onmicrosoft.com“.

The Validity period specifies the length of time that a password is valid before it must be changed.

NotificationDays parameter specifies the number of days before a user receives notification that their password will expire.

The output of the above PowerShell script is given below.

Get Password Policy for domain in Office 365
Get a Password Policy for the domain in Office 365

Conclusion

I hope the above article on how to use the Get-MsolPasswordPolicy cmdlet in PowerShell to get the password policy for the domain in Office 365 is helpful to you.

You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.

Related Links

Set-MsolPasswordPolicy