Solved

active directory script

Posted on 2014-09-12
5
104 Views
Last Modified: 2014-10-01
Need help finding a script to add +1 to the telephone number in the general tab under an active directory user object. is this possible? I need to make this change to over 500 user objects in active directory. thanks.

this question is worth 500 points.
0
Comment
Question by:mildogz
5 Comments
 
LVL 28

Assisted Solution

by:becraig
becraig earned 167 total points
Comment Utility
gc c:\userlist.txt | % {
$username = $_
$oldphone = GetADUser -Identity $username -Properties OfficePhone
$nuphone = "1" + $_.OfficePhone
Set-ADUser -Identity $username -OfficePhone $nuphone -whatif
}

Open in new window


Something like above should work (untested)
0
 
LVL 38

Accepted Solution

by:
Jim P. earned 167 total points
Comment Utility
P would look at using the  dsmod user.

You can do a dsquery to get the right person.

It will be something like
DSQUERY USER -samid doej| DSMOD user -phone1 8005551212

Open in new window

0
 
LVL 21

Assisted Solution

by:dan_blagut
dan_blagut earned 166 total points
Comment Utility
hello


You can use this Vbscript
Set ArrayUser = GetObject  ("LDAP://OU=test,DC=N2NetworkSolutions,DC=com")
ArrayUser.filter=Array ("user")
For Each objUser In ArrayUser
objUser.get "officePhone", phone
phone="+1"&phone
objUser.Put "officephone", phone
objUser.SetInfo
Next

for testing you can begin with a small test OU, then launch at large scale. The target can be configurated on the GetObject parameters.

Dan
0
 
LVL 1

Author Comment

by:mildogz
Comment Utility
hey thanks folks. I have not gotten around to testing yet. we had some hold up and I was away for two weeks. so I will try some of this scripts and let you know. I apologies for the delay here. thanks again.
0
 
LVL 1

Author Closing Comment

by:mildogz
Comment Utility
thanks guys. We end up just doing it manually. but will keep the info in case i need for future reference.
0

Featured Post

Do email signature updates give you a headache?

Do you feel like you are constantly making changes to email signatures? Are the images not formatting how you want them to? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today.

Join & Write a Comment

After having deployed hundreds of thousands of Terminal Services seats worldwide, I still see all the time people asking me that same old question: "If TS/RDS is that reliable why are you telling me I should reboot it that often? My DC/SQL/Exchange/…
Remote Apps is a feature in server 2008 which allows users to run applications off Remote Desktop Servers without having to log into them to run the applications.  The user can either have a desktop shortcut installed or go through the web portal to…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now