今天就简单的说一下如何在O365 PowerShell 配置用户密码永不过期。

首先我们要下载一个组件,分别叫做适用于 IT 专业人员的 Microsoft Online Services 登录助手 RTW用于 Windows PowerShell 的 Azure Active Directory 模块

适用于 IT 专业人员的 Microsoft Online Services 登录助手 RTW下载地址:https://www.microsoft.com/zh-CN/download/details.aspx?id=39267

用于 Windows PowerShell 的 Azure Active Directory 模块下载地址:http://go.microsoft.com/fwlink/p/?linkid=236297

PS:自 2014 年 10 月 20 日起,用于 Windows PowerShell 的 Azure Active Directory 模块(32 位版本)正式停用,将来对 Azure Active Directory 模块发布的更新只适用于 64 位版本。

1.先安装组件;

p_w_picpath

p_w_picpath

2.点击用于 Windows PowerShell 的 Azure Active Directory 模块;

p_w_picpath

3.连接O365,在powershell输入Connect-MsolService,并输入O365 管理员账号和密码(如果是Azure AD,就连接Azure AD管理员);

p_w_picpath

4.查看要配置用户的属性;

输入:get-MsolUser –UserPrincipalName xxxx@xxx.com | select user*,password*,可以看到该用户没用启动密码永不过期的;

p_w_picpath

5.配置并启动用户密码永不过期;

输入:set-MsolUser –UserPrincipalName xxx@xxx.com –PasswordNeverExpires $true

p_w_picpath

查看用户是否启动密码永不过期;

p_w_picpath

6.如果要为O365组织中的所有用户将密码设置为从不过期;  
输入:Get-MsolUser | Set-MsolUser -PasswordNeverExpires $true