Powershell管理系列(三十一)PowerShell操作之批量创建邮箱
-----提供AD\Exchange\Lync\Sharepoint\CRM\SC\O365等微軟產品實施及外包,QQ:185426445.電話18666943750
用戶需要批量導入郵箱,提供的信息,如姓名、別名、組織單元、顯示名、登錄名、密碼、公司名、部門、郵箱配額,表格如下圖
步驟1、在powershell中輸入如下命令:
Add-PSSnapin microsoft.exchange*
Import-Module activedirectory
Import-Csv C:\mbxinfo.csv | ForEach-Object `
{
new-mailbox -Name $_.name -Alias $_.alias -OrganizationalUnit $_.ou -DisplayName $_.displayname -UserPrincipalName $_.upn `
-Password (ConvertTo-SecureString -String $_.pwd -AsPlainText -Force)
set-mailbox -Identity $_.upn -IssueWarningQuota $_.IssueWarningQuota -ProhibitSendQuota $_.ProhibitSendQuota `
-ProhibitSendReceiveQuota $_.ProhibitSendReceiveQuota -UseDatabaseQuotaDefaults $false
Set-User -Identity $_.upn -Company $_.company -Department $_.dept
}
步驟2、我們檢查,可以看到郵箱和ad賬號都已經批量建好
總結
以上是生活随笔為你收集整理的Powershell管理系列(三十一)PowerShell操作之批量创建邮箱的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: aardio学习笔记-变量与常量
- 下一篇: webService 客户端接口调用【j