My Blog
My Blog
Bulk Configuring OCS users for Ent Voice
Following from my previous articles on bulk enabling Remote Call Control and also bulk enabling users for OCS I thought I’d follow it up with the final bit which is bulk-enabling users for Enterprise Voice.
It may seem a subtle modification to the RCC script however there’s a bit more to the configuration - mainly to do with the telephone number associated with the user. There’s some interesting bits to this script process, so bare with me.
Before we jump in, I’m assuming you’re familiar with E.164 numbering!
Microsoft recommends that administrators populate the ‘telephoneNumber’ AD property (‘Telephone Number’ on the ‘General’ tab on the user) with the E.164 formatted telephone number. Now that’s all very well however I come across a certain reluctance for organisations to do this.
Why? Well predominantly it’s down to the readability of E.164 numbers for us mere humans. What I find is that the younger a person is the more comfortable they are with E.164 numbers, and conversely the older the less comfortable. I’m sure there’s a cut over point - maybes it’s the fabled ‘Generation Y’ of people who graduated after year 2000?
Some people find ‘+4416354449912’ far harder to parse than ‘01635 444 9912’.
Personally I’m happy with either, but then I work with E.164 every day.
Anyways, the result is that you can’t always rely on the ‘telephoneNumber’ property being in the correct format for your Enterprise Voice configuration.
There’s some interesting bits to this script you may find useful - so let’s run through it.
Download the script here. Now, before you run it you have to modify it to your environment. Which bits need modifying? Well download it and open it up in a script editor, preferably one with line numbering. As I’m on OSX I tend to use TextWrangler - on Windows Crimson Editor.
Download and open it up, and I’ll run through the bits you must modify, and the bits you can.
Country Code
You need to set the appropriate country code for your country so that the script correctly generates E.164 phone numbers for you. Lines 10/11 are what you need - see below:
====
'Set the country code for YOUR country
CountryCode=44
====
As I’m in the UK I’ve set the CountryCode to ’44’.
Default Location Profile
The next thing we need to customise is your own default location profile. Line 12 is to do with this (the line will probably wrap - needs to be on 1 line).
====
deflocprofile="CN={10484B2D-A99D-42F5-9255-04DF23D30957},CN=Location Profiles,CN=RTC Service,CN=Services,CN=Configuration,DC=deathstar,DC=local"
====
Above looks a bit complex doesn’t it? Well it doesn’t have to be. Fire up ADSIEDIT and copy it from a current user who has the appropriate default location profile - the property you want it ‘msRTCIP-UserLocationProfile’. Not too difficult, and it’ll make sure you’ve got the right value.
The Feed-File
We need to provide the script with a text file listing the target users. Each line contains an individual user, and the format can be in either SAMAccount name or by DSN. Consider my example here:

As you can see there’s a mixture of DSN & SAMAccount names there.
Running the Script
Executing the script couldn’t be easier. Drop it on to the Start/Run dialogue box and then append the path to the feed-file to it. You can even drag/drop the feed file if you want. Example below.

You can also use the CSCRIPT.exe shell to run it from a DOS prompt too if you want.
Script Output
The script will output a couple of log files - one detailing any accounts that couldn’t be activated, and one showing a general log for the whole operation.
You can download an example log file here. Let’s have a look at bits of the general log.

The first bit just shows you who is running the script, which domain, what workstation and where the log file has gone.

Second bit (above) shows the error file path and the given path to the feed file. If it can’t find the file it’ll be detailed here.
Next, let’s look at a user configuration. We won’t do all of them, we’ll just pick bits that are interesting.

The above just shows the SAMAccount being found and then being converted to a DSN. The script then binds to the user object.
The next bit is a little more interesting, as it’s the main process.

The phone number is found - note it’s not in E.164? Also, it’s got spaces in it. Computers don’t like spaces do they.... So, first the VBScript Replace() function to remove the spaces....
Next, the number is converted to an E.164 number. So we go from ‘0121 994 4400’ to ‘01219944400’ and then finally to ‘+44121994400’ - quite cool I think!
Next, the script will check to see if Remote Call Control is enabled. You cannot enable Remote Call Control and Enterprise voice at the same time. You can however set the ‘msRTCSIP-optionflags’ for both - and it just confuses the admin tools and it all goes horribly wrong.
If they user is enabled for RCC, then RCC is disabled by the script. This is done by modifying the ‘msRTCSIP-optionflags’ property - you can read more about that here.
Following that, UC (Or Enterprise Voice) is enabled, and the correct line property ‘sip:+44121994400’ is written out.
Also of course the default location profile is written set.
Not bad hey?
Any users who the script was unable to process are detailed in the error file.

In this instance it’s the pesky ‘Monkey’ user that can’t be located. I’ve done it in raw format simply so you can correct the names and feed the references back into the script.
So, the script will enable your users with Enterprise Voice regardless of the format of the number - as long as it has the actual number in ‘telephoneNumber’ it’ll do it.
Script Highlights
The main bit of interest is the private function ‘MakeE164(variable)’. Now, I confess that being UK based this has a certain UK bent to it.
First, the function checks to see if the number starts with ’00’ - that’s the international designator in the UK. If it does, it drops the ’00’ and adds a ‘+’. So ‘0012122222954’ (my fave NYC hotel) would become ‘+1212222954’. Exactly what we want.
The next check may take some modification for your target area. The function checks to see if the number begins with a ‘0’ but not ’00’. In the UK this means it’s a national (or local) number. It then drops the 0 and adds the country code.
For example ‘01635567891’ would become ‘+441635567891’.
You may need to modify this slightly to address your dialing patterns. Even so, I think it’s quite cool!
Summary
I find myself doing things repeatedly for different deployments so I’ve focussed on making more flexible scripts that can be re-used with minimal modification.
As they’re more flexible I thought I’d share them. Scripting is a fantastic way to learn a lot more about how a product & technology slots together.
Anyways, if you have any questions on this piece feel free to drop me an email - you can also follow me on twitter.
Thanks.
Friday, 24 July 2009
Email me about this article here.