创建了以下脚本以从 CSV 创建多个房间邮箱,但出现以下错误:
- 找不到与参数名称“编码”匹配的参数。
- 无法将争论绑定到参数“名称”,因为它是一个空字符串。
- 无法与参数“身份”争论,因为它为空。
$roomlist = Import-csv C:\temp\rooms.csv -Encoding ASCII
$orgunit = "OU=************"
foreach($room in $roomlist){
$roomname = $room.Fullname
#write-host $roomname
$first = $room.Site
$last = $room.Room
$capacity = $room.cap
$mailalias = $room.Fullname -replace '\W',''
$mail = $mailalias + "@***email address***"
$samaccountname = $room.samaccountname
$upnname = $samaccountname + "@***email address***"
#write-host $roomname $mail $capacity $mailalias $samchop
write-host $samaccountname
New-Mailbox -Name $roomname -Room -SamAccountName $samaccountname -FirstName $first -LastName $last -UserPrincipalName $upnname -PrimarySmtpAddress $mail -alias $mailalias -ResourceCapacity $capacity -Database 'DBNAME' -OrganizationalUnit $orgunit
#set-CalendarProcessing $roomname -AutomateProcessing autoaccept
Set-Mailbox -HiddenFromAddressListsEnabled $true -Identity $roomname
}