Pages

Thursday, August 1, 2013

Script to mass enable users for Exchange UM

During Lync deployments, I have often run into the need to mass enable multiple users for Unified Messaging. To do this, I altered an existing script (I cannot remember where I found it) to do this using a CSV file. Here is the script:

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
If you want the PIN to not prompt the user to change it on first log on, change the -PinExpired value to $False. You can also manually set the PIN if the need arises by adding '-Pin $c.pin' to the Enable-ummailbox line and add a column to the CSV file with the header of 'pin'.

Let me know if you have any questions or comments about this script. Hope this helps.

3 comments:

  1. Hi there and thanks for this.
    Do you know a way to set the extension? And also do u need to enter a sip resource identifyer?

    ReplyDelete
    Replies
    1. 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.

      Delete
  2. This also could be a solution...
    https://gallery.technet.microsoft.com/Enable-UM-in-exchange-8a221ec1

    ReplyDelete