在混合模型中创建批量用户 - Exchange 2016

在混合模型中创建批量用户 - Exchange 2016

我可以通过这个脚本创建帐户

$CSVLocation = "C:\temp\RemoteUserMailboxes.csv"
Import-CSV $CSVLocation | ForEach-Object {
New-RemoteMailbox -Name $_.Name -FirstName $_.FirstName -Initials $_.Initials -Lastname $_.LastName -OnPremisesOrganizationalUnit $_.OU -UserPrincipalName $_.UPN -Password (ConvertTo-SecureString $_.password -AsPlainText -Force) -ResetPasswordOnNextLogon:$true }

为了向用户添加属性,我尝试在 Exchange 管理外壳上运行此脚本。但会引发错误

无法执行该操作,因为在“dc1.ittechsolution.com”上找不到对象“venky”

$Contacts = Import-CSV -path "C:\temp\RemoteUserMailboxes.csv"
$contacts | ForEach {Set-contact $_.Name -StreetAddress $_.StreetAddress -City $_.City -StateorProvince $_.StateorProvince -PostalCode $_.PostalCode -Phone $_.Phone -MobilePhone $_.MobilePhone -Pager $_.Pager -HomePhone $_.HomePhone -Company $_.Company -Title $_.Title -OtherTelephone $_.OtherTelephone -Department $_.Department -Fax $_.Fax -Initials $_.Initials -Notes $_.Notes -Office $_.Office }

为什么会出现这个错误?

相关内容