$path = "C:\Scripts\05-Script\Contacts.csv"
$Database = "xDB"
$OU = "XUnit/Test"
#$Password = (Get-Credential).Password
$Password = ConvertTo-SecureString "[email protected]" -AsPlainText -Force
Import-Csv $path | ForEach-Object {
$FirstName = $_."FirstName"
$LastName = $_."LastName"
$Alias = $_."Alias"
$UserPrincipalName = $Alias # +xdomain.com"
$OtherEmail = $FirstName +"."+ $LastName + "@xdomain.com"
$DisplayName = $LastName+", "+$FirstName
New-Mailbox -Alias $Alias `
-Name $Alias `
-FirstName $FirstName `
-LastName $LastName `
-DisplayName $DisplayName `
-SamAccountName $Alias `
-UserPrincipalName $UserPrincipalName `
-Database $Database `
-OrganizationalUnit $OU `
-Password $Password `
-ResetPasswordOnNextLogon $false
}
歡迎來到Stack Overflow!您不需要爲帖子添加簽名 - 您的用戶卡會自動顯示在其下方。 – Artemix