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
2、輸入import-moudle MSOnline導入O365的模塊,運行Get-Module可以看到MSOnline已經導入。
3、接下來輸入Connect-MsolService登陸到O365
4、登陸後輸入Get-MsolUser可以查看到雲中的用戶信息
5、下面進行用戶密碼重置,可以根據需求選擇從部門或者地區來批量重置,命令如下:
Get-MsolUser -State X | Set-MsolUserPassword -NewPassword "p@ssw0rd"