批量创建exchange 2010/2013/2016邮箱

域控上创建对应OU
批量创建exchange邮箱

  1. 定义一个统一密码:password
    $MailPasswd =ConvertTo-SecureString password -AsPlainText -Force

2.新建CSV文件NewMail.csv,格式如下
LastName,UserPrincipalName,Database,Alias,DisplayName,OrganizationalUnit,FirstName,Name,

LastName :姓
UserPrincipalName :邮箱地址
Database :指定数据库
Alias :别名
DisplayName :显示名称
OrganizationalUnit :指定一个OU
FirstName :名
Name :姓名

  1. 以管理员身份运行:Exchange Management Shell,运行下面命令

Import-Csv D:\test\NewMail.csv | ForEach-Object -Process {New-Mailbox -ResetPasswordOnNextLogon:$False -LastName $_.LastName -UserPrincipalName $_.UserPrincipalName -Database $_.Database -Alias $_.Alias -Password $MailPasswd -DisplayName $_.DisplayName -OrganizationalUnit $_.OrganizationalUnit -FirstName $_.FirstName -Name $_.Name}

猜你喜欢

转载自blog.51cto.com/3032439/2472890