Script - to create users in AD and enable it for Office Communications server
I wrote a simple script to automate the process of user account creation in AD and to enable them for OCS with EV, which I am sharing at this blog... Before I start talking about the script further, I'd request everyone to read the following disclaimer carefully.
Disclaimer: Run the script in your environment at your own risk. This script re-writes proxyAddresses, so modify the script to have proper proxyAddresses value if you have Exchange setup. Please don’t run this script in production at any cost without testing it in your test environment, and without further modifying it to suit your requirements.
About the script: This script takes a CSV file as an input with following parameters of the user...
Display Name, SAMAccountName, UserPrincipalName, TelephoneNumber, Description, SIP Address.
The script will do followings…
· It will create the user.
· It’ll read display name from the file and write FirstName, LastName and DisplayName of the user.
· It’ll set the TelephoneNumber of the user.
· It’ll enable the user for Office Communications server
· It’ll set the SIP address (msRTCSIP-PrimaryUserAddress)
· It’ll assign the user to a pool (msRTCSIP-PrimaryHomeServer)
· It’ll enable the user for Enterprise Voice (msRTCSIP-OptionFlags)
· It’ll assign the Line URI (msRTCSIP-Line)
Steps to run the script:
Step 1:
Copy the following script and save it as “createNenableUsers.vbs”.
‘=======================================
dim Header,FileName,fs,fl,objOU
set fs=CreateObject("Scripting.FileSystemObject")
set fl=fs.OpenTextFile("C:\scripts\User_Accounts-ADS-CSV.csv")
Header=fl.ReadLine
arHdr=split(Header,",")
Header=""
' DN of the OU where USers are supposed to be created
lDapPath="OU=UC,dc=ucdom,dc=local"
for i=0 to ubound(arHdr)
Header=Header & arHdr(i) & vbTab
next
wscript.echo Header
Set objOU = GetObject("LDAP://" & lDapPath)
on error resume next
while fl.AtEndOfStream=False
errorsOccured=0 'no errors
userLine=fl.ReadLine
arUser=split(userLine,",")
Set objUser = objOU.Create("User", "cn=" & arUser(0))
'assuming that fields in CSV files are: CN,sAMAccountName,UserPrincipalName,Telephone Number,Description
'Generate firstname(givenName),lastname(sn),displayname (displayname)
arUinfo=split(arUser(0)," ")
objUser.Put "givenName",arUinfo(0)
objUser.Put "sn",arUinfo(1)
objUser.Put "displayName",arUser(0)
objUser.Put "sAMAccountName",arUser(1)
objUser.Put "UserPrincipalName",arUser(2)
objUser.Put "telephoneNumber",arUser(3)
objUser.Put "description",arUser(4)
objUser.Put "msRTCSIP-PrimaryUserAddress",arUser(5)
objUser.Put "proxyAddresses",arUser(5)
objUser.Put "msRTCSIP-Line","Tel:+" & arUser(3)
objUser.SetInfo
if err.number <> 0 then
wscript.echo "[Error] processing user: [" & arUser(0) & "] " & err.description
errorsOccured=1 'errors occured
err.clear
end if
objUser.SetPassword "Password@123"
objUser.accountDisabled=FALSE
objUser.put "msRTCSIP-UserEnabled",TRUE
objUser.Put "pwdLastSet", 0
objUser.Put "msRTCSIP-PrimaryHomeServer","CN=LC Services,CN=Microsoft,CN=UCOCSR2,CN=Pools,CN=RTC Service,CN=Services,CN=Configuration,DC=ucdom,DC=local"
objUser.Put "msRTCSIP-OptionFlags",384
objUser.SetInfo
if err.number <> 0 then
wscript.echo "[Error] processing user password/account settings: [" & arUser(0) & "] " & err.description
errorsOccured=1 'errors occured
err.clear
end if
if errorsOccured=0 then
wscript.echo userLine & "...Processed."
else
wscript.echo userLine & "...Processing..."
end if
err.clear 'clear last error.
wend
fl.close
set fs=nothing
‘===============================================
Step 2: Modify location of the input file…
set fl=fs.OpenTextFile("C:\scripts\User_Accounts-ADS-CSV.csv")
Step 3: Modify the LDAP path, where you want to create the users..
lDapPath="OU=UC,dc=ucdom,dc=local"
Step 4: Modify the following line to set the default password…
objUser.SetPassword "Password@123"
Step 5: change the Pool DN
objUser.Put "msRTCSIP-PrimaryHomeServer","CN=LC Services,CN=Microsoft,CN=UCOCSR2,CN=Pools,CN=RTC Service,CN=Services,CN=Configuration,DC=ucdom,DC=local"
Step 6: After modifying the script as per your setup… run the following command...
Cscript createNenableUsers.vbs
Note: You should run the command from a location where this script is located.
I am sure you would need to modify the script as per your need, if you encounter any problem while doing it... Leave a comment and if time permits, I’ll respond with a reply.
Comments
Anonymous
July 06, 2010
Hi, Please clear my doubt. Does this script to be run in Communication Server or we can run the script in any DC in the domain. If i run the script in any other domain does this SIP will enable in communication server? Thanking you in advance, PremAnonymous
September 13, 2010
You can run this script from any machine in the domain. Regards, RamAnonymous
May 17, 2011
I recently wrote a script more like yours, however after all settings have been committed, and I can verify that in AD, OCS does not seem to recognise that the user is indeed enabled for OCS and voice unless I open the users and click ok instead of cancel.Anonymous
August 21, 2014
As nice blog,but you could have made this blog more cool if you could configure the language changer pluigin but all the same you have donehttp://www.iessaywriter.com">http://www.iessaywriter.com a good jobAnonymous
February 02, 2015
Thanks for this super amazing posts. http://www.isubwaysurfersforpc.com/subway-surfers-for-pc-free-download-windows.htmlAnonymous
February 02, 2015
I think when you are doing the things possible then its Clash of Clans for PChttp://clashofclansforpcc.comAnonymous
February 02, 2015
We have working guide for downloading WeChat on Computer http://www.wechatforpcr.comAnonymous
February 02, 2015
I want to tell you that its really possible to enjoy downloading Clash of Clans on Computerhttp://clashofclanspcworld.comAnonymous
February 02, 2015
So folks, you want to download WhatsApp Messenger on PC check this out : http://www.whatsappforpcmi.com/whatsapp-for-pc-download-windows-7-8-computer-laptop/Anonymous
April 01, 2015
I am early waiting for the iOS 9 release date and iPhone 7 release date:
http://www.ios9releasedate.comAnonymous
May 16, 2015
Thanks for such a share.Well I would also like to share something with you guys
http://www.whatsappforpcpro.com/Anonymous
May 16, 2015
Hey giys I just found out a new way through which you can get imessage on Android and you can check that out here
http://www.getappsonpc.com/imessage-for-android-phone-apk-download/Anonymous
May 24, 2015
The comment has been removedAnonymous
May 24, 2015
Thanks for post this helpful post - Please visit for More information about -
http://www.expert5th.in/packers-and-movers-hyderabad/
http://packersmoverspune.top3rd.in/
http://www.expert5th.in/packers-and-movers-mumbai/
http://www.expert5th.in/packers-and-movers-chennai/Anonymous
May 24, 2015
Thanks for all your information, Website is very nice and informative content.
http://www.expert5th.in/packers-and-movers-noida/
http://www.expert5th.in/packers-and-movers-thane/
http://www.expert5th.in/packers-and-movers-navimumbai/
http://www.expert5th.in/packers-and-movers-ghaziabad/
http://www.expert5th.in/packers-and-movers-faridabad/Anonymous
May 24, 2015
The comment has been removedAnonymous
May 24, 2015
Thanks for all your information.Website is very nice and informative content.
http://www.smaart5th.in/packers-and-movers-in-mumbai/
http://www.smaart5th.in/packers-and-movers-in-delhi/
http://www.smaart5th.in/packers-and-movers-in-gurgaon/
http://www.smaart5th.in/packers-and-movers-in-pune/Anonymous
May 24, 2015
Thanks for all your information, Website is very nice and informative content.
If you are looking Best Packers and Movers so Visit at :
http://www.smaart5th.in/packers-and-movers-in-navimumbai/
http://www.smaart5th.in/packers-and-movers-in-thane/
http://www.smaart5th.in/packers-and-movers-in-noida/
http://www.smaart5th.in/Anonymous
May 29, 2015
Great blog and I appreciate the content that you have written
http://www.getappsonpc.com/tinder-for-pc-download/
http://www.getappsonpc.com/imessage-for-android-phone-apk-download/Anonymous
May 29, 2015
Great blog and I appreciate the content that you have written
http://www.getappsonpc.com/tinder-for-pc-download/
http://www.getappsonpc.com/imessage-for-android-phone-apk-download/Anonymous
May 29, 2015
Great blog and I appreciate the content that you have written
http://www.getappsonpc.com/tinder-for-pc-download/
http://www.getappsonpc.com/imessage-for-android-phone-apk-download/Anonymous
June 22, 2015
This article is really fantastic and thanks for sharing the valuable post.
http://www.expert5th.in/packers-and-movers-pune/
http://packersmoverspune.top3rd.in/Anonymous
July 07, 2015
This article is really fantastic and thanks for sharing the valuable post.
http://packersmoverspune.top3rd.in/Anonymous
July 07, 2015
The comment has been removedAnonymous
July 07, 2015
Thanks for all your information.Website is very nice and informative content.
http://www.dteller.in/packers-and-movers-delhi/
http://www.dteller.in/packers-and-movers-gurgaon/
http://www.dteller.in/packers-and-movers-mumbai/Anonymous
July 07, 2015
This article is really fantastic and thanks for sharing the valuable post.
http://www.expert5th.in/packers-and-movers-pune/Anonymous
July 10, 2015
I really enjoyed & liked everything.
Thanks for sharing informative post ........
REF: http://quickfansandlikes.com/Anonymous
July 11, 2015
This is something with which I am totally agreed for sure.. Loved the way now we can play candy crush on PC. check full guide herehttp://droidadda.com/play-candy-crush-for-pc/ .. ThanksAnonymous
July 12, 2015
The comment has been removedAnonymous
August 08, 2015
Wow. Thanks for sharing. I like this article.
http://pancardstatusin.comAnonymous
August 21, 2015
https://medium.com/@adarshshah/how-to-apply-and-track-pan-status-in-india-cc1b5862112
http://adarsh27.kinja.com/what-is-pan-card-status-how-to-get-it-1714608633
http://www.instructables.com/id/What-is-PAN-Card/
http://pancard.snack.ws/
http://adarshgm2.inube.com/blog/4402173/how-to-get-pan-card-or-duplicate-pan-card-status-without-acknowledge-no/
http://appsforpc.india.com/post/know-your-pan-card-status-by-name-online-40407
http://www.communitychannel.org/your-community-space/ycs-blogs/55b3707690eaf/
http://www.kiwibox.com/adarshgm2/blog/entry/131710569/get-online-pan-card-status-here/?pPage=0
https://www.rebelmouse.com/adarshgm2/how-to-apply-online-for-adhaar-card-1268025030.html
http://www.imfaceplate.com/adarshgm2/how-to-know-your-pan-card-status-online
http://indyarocks.com/blog/2375804/Know-Your-Pan-Card-Status-Here
http://technology.zumvu.com/track-your-pan-card-status-here
http://adarshgm2.buzznet.com/user/journal/26492926/verify-pan-card-status-here/
http://justpaste.it/PANcardstatus
http://pancardstatus.jimdo.com/
http://adarshgm2.postbit.com/how-to-apply-for-new-pan-card-online.html
http://adarshgm2.mywapblog.com/see-your-pan-card-status-without-acknowl.xhtml
https://www.smore.com/upgkk-why-adhaar-card-is-necessary
https://entertainment27.edublogs.org/2015/08/04/how-to-get-adhaar-card-status-online/
http://pan-card-status.webnode.com/news/documents-required-for-aadhaar-card-enrollment/
http://www.merchantcircle.com/blogs/seo.456-456-4561/2015/8/Get-Pan-Card-Status-Here/1275979
http://www.purevolume.com/dashboard?s=posts&tab=posts
http://keralalotteryresult.sportsblog.com/posts/2975160/get-print-of-your-adhaar-card.html
http://technology1.doomby.com/blog/get-your-aadhaar-card-status-on-mobile.html
http://adarshgm2.blog.com/2015/08/05/requirements-to-verify-pan-card-status/
http://writers.sportskeeda.com/?p=2402240&preview=true
http://www.mediamatic.net/399751/en/how-to-get-e-adhaar-card-download
http://uchem.berkeley.edu/forum/read.php?3,1632078,1632078#msg-1632078
http://www.buzzfeed.com/post?id=3928570
http://pancardstatus.samenblog.com/How%20to%20Get%20status%20of%20My%20Adhaar%20Card%20Online/
https://unisa-au.academia.edu/AdarshShah/Posts/5791103/Reprint-your-Adhaar-Card-online-Adhaar-Card-is-a-government-authorized-free-procedure-in-which-every
http://community.eldis.org/adarshgm2/.5c5dc7a9/.5c5dc7d6
http://adarshgm2.tumblr.com/post/126319805481/get-status-of-your-pan-card-without-knowing
http://adarshgm2.bcz.com/2015/08/10/go-online-to-check-your-pan-card-status/
http://www.twitlonger.com/show/n_1sn8d75
https://storify.com/adarshgm2/check-online-pan-card-status-here#publicize
http://pancardstatus.weebly.com/
https://adarshgm2.wordpress.com/2015/08/13/uidai-e-aadhaar-card-download/
https://moz.com/posts/manage
http://pancardstatus.unblog.fr/2015/08/21/get-pan-card-status-online-free-guidelines/
http://entertainments.hatenablog.com/entry/2015/08/21/153852
http://informations.wallinside.com/
http://pancardstatus.zohosites.com/blogs/post/Watch-Pan-Card-Status-OnlineAnonymous
August 23, 2015
http://www.techtweetz.com/clash-of-clans-for-pc-download-windows-10-7-8-xp-free/Anonymous
August 23, 2015
http://www.techtweetz.com/clash-of-clans-for-pc-download-windows-10-7-8-xp-free/>Anonymous
August 24, 2015
http://www.androidcustomize.com/2014/12/download-showbox-app-for-pc-windows-78.htmlAnonymous
September 09, 2015
Thanks for the information
http://buzzoid.co/
http://buzzoid.co/buy-instagram-likes.html
http://buzzoid.co/buy-instagram-followers.html
http://morefollowersonline.com/
http://morefollowersonline.com/buy-instagram-likes.html
http://morefollowersonline.com/buy-instagram-followers.htmlAnonymous
September 19, 2015
thanks , and here the clash of clans links
http://www.techtweetz.com/clash-of-clans-for-pc-download-windows-10-7-8-xp-free/Anonymous
September 23, 2015
The comment has been removedAnonymous
September 25, 2015
WhatsApp for PC Way is a perfect solution http://appsforpcway.com/whatsapp-for-pc-download-windows-7-computer-free/Anonymous
September 25, 2015
Here is a perfect guide to get WeChat messenger for PC http://wechatforpcworld.com/Anonymous
September 25, 2015
Xender for PC http://www.xenderforpcguide.com/download-xender-for-pc-windows-7-8/
http://www.xenderforpcguide.com/
http://www.xenderforpcguide.com/gionee-xender-for-pc-download-windows-78xp/Anonymous
September 25, 2015
nice article to get Clash of Clans for PC http://clashofclansforpcworld.com/
http://clashofclansforpcworld.com/category/clash-of-clans/Anonymous
September 25, 2015
http://teciworld.com/clash-of-clans-for-pc-download-on-windows-78-without-bluestacks/
http://teciworld.com/download-hay-day-for-pc-or-computer-windows-78xp/
http://teciworld.com/photo-grid-for-pc-download-windows-78-computer/Anonymous
October 13, 2015
The comment has been removedAnonymous
October 13, 2015
http://www.iresumetemplates.comAnonymous
October 17, 2015
The comment has been removedAnonymous
October 19, 2015
http://wechatforpcworld.com/wechat-for-pc-download-windows-7-8/
http://wechatforpcworld.com/category/wechat-for-pc/Anonymous
November 17, 2015
How It Works | How to Insert The DivaCup Menstrual Cup
http://lunapads.com/divacup
http://divacup.com/
http://www.ladycup.eu/
http://divacup.com/how-it-works/your-first-questions/
http://divacup.com/how-it-works/how-it-works/
http://divacup.com/products/the-divacup/
http://menstrualcupreviews.net/Anonymous
December 10, 2015
i think this problem is related to Windows. Try using windows 8 product key
source: www.tech1up.comAnonymous
December 10, 2015
http://www.tech1up.com/Anonymous
December 15, 2015
http://www.happynewyear2016s.org/2015/10/new-year-messages.html
http://www.newyearimages2016.com/
http://www.newyearimages2016.com/2015/08/new-year-2016-images-pictures-photos-hd-free-download.html
http://www.newyearimages2016.com/2015/11/happy-new-year-2016-dinner-ideas-best.htmlAnonymous
December 15, 2015
Thanks a lot for sharing the post. I loved reading it!
http://www.newyearwishes2016.net/
http://www.newyearwishes2016.net/2015/09/happy-new-year-pictures.html
http://www.newyearwishes2016.net/2015/08/new-year-images.html
http://www.newyearwishes2016.net/2015/07/happy-new-year-images.html
http://www.newyearwishes2016.net/2015/08/happy-new-year-image.htmlAnonymous
December 27, 2015
The comment has been removedAnonymous
January 02, 2016
Thanks for sharing this useful guide....
http://www.rushinformation.comAnonymous
January 08, 2016
Thanks for all your information, Website is very nice and informative content.
http://www.roknelbeet.com/?p=110
http://www.roknelbeet.com/?p=39
http://www.roknelbeet.com/?p=120
http://www.roknelbeet.com/?p=122
http://www.roknelbeet.com/?p=127
http://www.roknelbeet.com/?p=131
http://www.roknelbeet.com/?p=30
http://www.roknelbeet.com/?p=50
http://www.roknelbeet.com/?p=43
http://www.roknelbeet.com/?p=55
http://www.roknelbeet.com/?p=68
http://www.roknelbeet.com/?p=70
http://www.roknelbeet.com/?p=63
http://www.roknelbeet.com/?p=59
http://www.roknelbeet.com/?p=325
http://www.roknelbeet.com/?p=35
http://www.roknelbeet.com/?p=152
http://www.roknelbeet.com/?p=161
http://www.roknelbeet.com/?p=275
http://www.roknelbeet.com/?p=271
http://www.roknelbeet.com/?p=167
http://www.roknelbeet.com/?p=172
http://www.roknelbeet.com/?p=177
http://www.roknelbeet.com/?p=185
http://www.roknelbeet.com/?p=181
http://www.roknelbeet.com/?p=41
http://www.roknelbeet.com/?p=86
http://www.roknelbeet.com/?p=96
http://www.roknelbeet.com/?p=100Anonymous
January 08, 2016
http://www.roknelbeet.com/?p=104
http://www.roknelbeet.com/?p=91
http://www.roknelbeet.com/?p=37
http://www.roknelbeet.com/?p=138
http://www.roknelbeet.com/?p=145
http://www.roknelbeet.com/?p=400
http://www.roknelbeet.com/?p=279
http://www.roknelbeet.com/?p=196
http://www.roknelbeet.com/?p=191
http://www.roknelbeet.com/?p=541
http://www.roknelbeet.com/?p=548
http://www.roknelbeet.com/?p=560
http://www.roknelbeet.com/?p=552
http://www.roknelbeet.com/?p=577
http://www.roknelbeet.com/?p=536
http://www.roknelbeet.com/?p=572
http://www.roknelbeet.com/?p=568
http://www.roknelbeet.com/?p=516
http://www.dar-elsafwa.com/?p=66
http://www.dar-elsafwa.com/?p=91
http://www.dar-elsafwa.com/?p=71
http://www.dar-elsafwa.com/?p=56
http://www.dar-elsafwa.com/?p=80
http://www.dar-elsafwa.com/?p=48
http://www.dar-elsafwa.com/?p=85Anonymous
January 08, 2016
http://www.roknelbeet.com/?p=30
http://www.roknelbeet.com/?p=50
http://www.roknelbeet.com/?p=68
http://www.roknelbeet.com/?p=55
http://www.roknelbeet.com/?p=39
http://www.roknelbeet.com/?p=110Anonymous
January 11, 2016
http://ihappybirthdaywishes.com/
celebrityplasticsurgeryxp.com
http://trufflenation.com/
http://planerreviews.net/
http://planerreviews.net/dewalt-dw735x-two-speed-planer-review/
http://planerreviews.net/bosch-1594k-planer-kit-review/Anonymous
January 11, 2016
http://ihappybirthdaywishes.com/
http://celebrityplasticsurgeryxp.com
http://trufflenation.com/
http://planerreviews.net/
http://planerreviews.net/dewalt-dw735x-two-speed-planer-review/
http://planerreviews.net/bosch-1594k-planer-kit-review/Anonymous
January 20, 2016
Thanks for this wonderful share. Now Download Game of War for PC at http://www.gameofwarforpc.comAnonymous
January 23, 2016
Thanks for this wonderful article...You can now enjoy playing Game of War Fire Age on PC as well via Game of War for PC Windows
http://www.gameofwarforpc.com
http://www.gameofwarforpc.com/game-of-war-for-pc-windows-108-17-game-of-war-on-pc/
http://www.gameofwarforpc.com/game-of-war-for-pc-windows-108-17-game-of-war-on-pc/
http://www.gameofwarforpc.com/game-of-war-for-pc-bluestacks-installation-windows-108-17/
http://www.gameofwarforpc.com/game-war-pc-game-war-fire-age-pc/Anonymous
February 11, 2016
http://www.epassstatus.co.in
http://www.epass.net.in
http://www.telanganaepass.co.in
http://www.epassscholarships.in
http://www.easyhyderabad.com
http://www.dtdccouriertracking.co.in
http://theonlineking.com
http://rajuginne.com
http://railwaysamachar.com
http://www.epfbalancestatus.in
http://www.speedposttrackingindia.in
http://www.eaadharcard.co.in
http://www.rationcard.net
http://www.voteridcardlist.in
http://liclogin.net
http://insurancetalk.in
https://tspscjobs.co.in
http://tspscguru.com
http://allnewgovtjobs.in
http://www.mytvshowz.in
http://shopatcheap.com
http://www.duniawale.com
http://www.airtet.inAnonymous
February 28, 2016
The comment has been removedAnonymous
March 04, 2016
check your http://gateresult2016.co.in/ avaliable hereAnonymous
March 06, 2016
awesome stuff.. keep it up.. http://bluedartcustomercares.com/Anonymous
March 10, 2016
check this out: http://www.techvicity.com/2016/02/dead-island-2-release-date-system-requirements-gameplay-trailer.htmlAnonymous
April 13, 2016
http://happymothersday2016quote.com/Anonymous
April 19, 2016
The comment has been removed