if ($args[0] -eq $null)
{
$userNameFile = read-host "Please enter the full path of the .csv file with user aliases."
$usernamefile = $usernamefile -replace '"',""
} else {
$usernamefile = $args[0]
}
if($userNameFile -ne "")
{
$csv=import-csv $userNameFile
} else {
"Unable to find a valid CSV with user Aliases, extensions and UM policy name. Please try again later."
exit
}
foreach($c in $csv )
{
"Enabling User " + $c.Alias + " using UM mailbox policy = " + $c.umpolicy
Enable-ummailbox -id $c.Alias -PinExpired $True -ummailboxpolicy $c.umpolicy -extensions $c.extension
}
The CSV file for this script will look like this:
Alias | extensions | umpolicy |
User1 | 1234 | Policy Name |
User2 | 1235 | Policy Name |
User3 | 1236 | Policy Name |
The Alias column can contain any of the following values for the Identity parameter:
- ADObjectID
- GUID
- Distinguished name (DN)
- Domain\Account
- user principal name (UPN)
- LegacyExchangeDN
- SmtpAddress
- Alias
Let me know if you have any questions or comments about this script. Hope this helps.
Hi there and thanks for this.
ReplyDeleteDo you know a way to set the extension? And also do u need to enter a sip resource identifyer?
The script does set the extension and you do not need to enter a SIP resource identifier unless you want to assign a specific one.
DeleteThis also could be a solution...
ReplyDeletehttps://gallery.technet.microsoft.com/Enable-UM-in-exchange-8a221ec1