如何使用powershell批量创建office 365账号

网友投稿 345 2022-10-04

如何使用powershell批量创建office 365账号

首先,对powershell做一个简单介绍。

当前powershell有四版本,分别为1.0,2.0,3.0 ,4.0

如果您的系统是window7或者Windows Server 2008,那么PowerShell 2.0已经内置了,可以升级为3.0,4.0。如果您的系统是Windows 8 或者Windows server 2012,那么PowerShell 3.0已经内置了,可以升级为4.0。如果您的系统为Windows 8.1,windows 10或者Windows server 2012 R2,那默认已经是4.0了。

Powershell 1.0 下载地址

Powershell 2.0 下载地址

powershell3.0 介绍,下载

powershell4.0 介绍,下载

Powershell管理office 365云服务需要安装两个工具

1.Microsoft Online Services Sign-In Assistant for IT Professionals RTW

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

msonline

get-module

步骤二

连接到office 365。在windows powershell中输入如下命令

$UserCredential = Get-Credential

在“Windows PowerShell 凭据请求”对话框中,键入您的 Office 365工作或学校帐户 用户名和密码,然后单击“确定”。

运行以下命令。

Connect-MsolService -Credential $UserCredential

编辑csv文件,表头需要自己只做,包含这些列

DisplayName:显示名称,必填字段

UserPrincipalName:用户名,需要带后缀,比如user1@abc.com。必填字段。

City:城市

Country:国家

Department:部门

FirstName:姓

LastName:名

MobilePhone:手机号码

Office:办公室

Password:密码

PhoneNumber:办公电话

PostalCode:邮编

State:国家

StreetAddress:街道地址

Title:岗位

UsageLocation:国家编码,如CN,或US。必填字段。

具体参数的含义,可参考-Path “C:\Users\tommyjex\OneDrive - 中国电信股份有限公司上海分公司\综合\批量创建账号\批量创建-UNICODE.csv” | ForEach-Object{New-MsolUser -DisplayName $_.DisplayName -UserPrincipalName $_.UserPrincipalName -City $_.City -Country $_.Country -Department $_.Department -FirstName $_.FirstName -LastName $_.LastName -MobilePhone $_.MobilePhone -Office $_.Office -Password $_.Password -PhoneNumber $_.PhoneNumber -PostalCode $_.PostalCode -State $_.State -StreetAddress $_.StreetAddress -Title $_.Title -UsageLocation $_.UsageLocation -LicenseAssignment ‘teckwah0:ENTERPRISEPACK_NO_RMS‘ -PasswordNeverExpires $true -ForceChangePassword $False}

这样即可完成Office 365账号的批量导入

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Java实现聊天室界面
下一篇:Office 365批量创建用户以及消除用户信息乱码的方法
相关文章

 发表评论

暂时没有评论,来抢沙发吧~