We help IT Professionals succeed at work.

Script to TEL URI for OCS from a list (of incrementing numbers)

We simply need to be able to script incrementing Tel Uri's...

For example

tel:+9000
tel:+9001
tel:+9002
tel:+9003 ...

This is temporary so it is alphabetical (by first name)
Comment
Watch Question

Distinguished Expert 2018

Commented:
I'm a bit confused. What do you want the script to *do* with the incrementing numbers it generates?

Author

Commented:
I have a list of incrementing numbers... I need to add them to the Tel Uri for OCS in AD
Distinguished Expert 2018

Commented:
So you want to walk through AD and add your numbers to every user AD object it encounters for enterprise voice? Do you want to restrict to a specific OU? Are these users already enabled for enterprise voice?

Author

Commented:
yes most are already enabled for enterprise voice.. it would be nice to restrict via OU
Distinguished Expert 2018

Commented:
Then I think your best bet is to use PowerShell v2, more specifically the Set-ItemProperty cmdlet in a loop through an AD collection
More on that cmdlet:
http://technet.microsoft.com/en-us/library/dd315383.aspx
 

Author

Commented:
I wish I was skilled in PS enough to knock that out.  Any help with the syntax that you might be able to offer?
Distinguished Expert 2018
Commented:
This technet page will get you 95% of the way there. It actually has an example for setting the description property for a filtered set of users for an OU.
http://technet.microsoft.com/en-us/library/dd391846(WS.10).aspx
All that is left is finding the property name for the telephone URI, which I don't know off the top of my head, and looping through the users from the Get-ADUsers cmdlet instead of doing a bulk set (since you want each value to be unique.)
A decent write-up on loops in PowerShell:
http://www.powershellpro.com/powershell-tutorial-introduction/logic-using-loops/
Combine the two and look up that property name (google or ADSIEdit **CAREFULLY**)  and you can probably slap something together.

Author

Commented:
yeah thanks for the effort but I would be hard pressed to slap that together "safely".  I would leave that to you experts.  but thanks for the help.

Author

Commented:
Any ideas on how to make this loop.  I wish I could write this script by myself but I fear the results.
Distinguished Expert 2018

Commented:
If you want to write the script and post it here first, I'd be happy to do a code review. I don't, however, write scripts for people on EE. I will help lead them down the path, and provide constructive pointers, but I definitely follow the "it is better to teach a man to fish" mantra, and if I write the entire script myself then I'm simply giving away a service that others charge for and that is money out of their pocket. I hope you understand.
Maybe somebody else will be more willing to post, and if so, more power to them. And, as I said, if you want to make a go of it, I'd happily provide a peer review. There is just that one line I won't cross.  Apologies for the inconvenience.

Author

Commented:
ok ill give it a go and post what I come up with.