O365创建了大量用户后,需要批量重置用户密码,但是通过控制台一次只能重置少量用户。如果用户上千就会效率非常低下,这时候就需要用到O365的powershell来批量重置了。

首先需要下载powershell的o365支持模块:

Microsoft Online Services 登录助手,下载链接如下:

http://www.microsoft.com/zh-cn/download/details.aspx?id=41950

Microsoft Azure Active Directory 模块,下载链接如下:

http://go.microsoft.com/fwlink/p/?linkid=236297

1、以管理员身份运行powershell

O365批量重置用户密码

2、输入import-moudle MSOnline导入O365的模块,运行Get-Module可以看到MSOnline已经导入。

O365批量重置用户密码

3、接下来输入Connect-MsolService登陆到O365

O365批量重置用户密码

4、登陆后输入Get-MsolUser可以查看到云中的用户信息

O365批量重置用户密码

5、下面进行用户密码重置,可以根据需求选择从部门或者地区来批量重置,命令如下:

Get-MsolUser -State X | Set-MsolUserPassword -NewPassword "[email protected]"

O365批量重置用户密码