利用PowerShell设置PasswordExpiration有2种情况:
1. 针对单一用户设置永不过期,命令如下:
Set-MsolUser -UserPrincipalName “userprincipalname”–PasswordNeverExpires $true
2. 针对所有用户设置永不过期的命令如下:
Get-MsolUser | Set-MsolUser –PasswordNeverExpires $true
注意:为了安全起见,微软不推荐对所有用户统一设置Password永不过期。
举例说明:以 [email protected]为例,将其Password设置为永不过期,具体步骤如下:
1. 用Administrator打开Azure ActiveDirectory Module for Windows PowerShell这个工具,输入如下命令,链接Online Service:
import-modulemsonline
$cred=get-credential
Connect-msolservice–credential $cred
2. 根据需求,输入如下命令: