Powershell在世纪互联Office365中批量将用户添加到组
1 $NewUserPath = ".\Office365AddUserToGroup.csv" 2 3 $NewUsers = import-csv $NewUserPath 4 5 foreach ($NewUser in $NewUsers) { 6 $Mail=$NewUser.Mail 7 $Mail 8 $Groups=$NewUser.Group 9 $Groups 10 11 $Groups.split(";") | ForEach { 12 $Group=$_ 13 $Group 14 Add-DistributionGroupMember $Group -Member $Mail -BypassSecurityGroupManagerCheck 15 } 16 echo ======================================================= 17 } 18 19 get-pssession | remove-pssession 20 21 Stop-Transcript
CSV格式:
Mail,Group
[email protected],[email protected];[email protected]
[email protected],[email protected]
[email protected],[email protected];[email protected];[email protected]
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。