Solved

active directory script

Posted on 2014-09-12
5
107 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 29

Assisted Solution

by:becraig
becraig earned 167 total points
ID: 40320513
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
ID: 40320520
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
ID: 40320587
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
ID: 40347024
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
ID: 40355271
thanks guys. We end up just doing it manually. but will keep the info in case i need for future reference.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The environment that this is running in is SCCM 2007 R2 running on a Windows 2008 R2 server. The PXE Distribution point is running on its own Windows 2008 R2 box. This is what Event viewer showed after trying to start the WDS service:  An erro…
On a regular basis I get questions about slow RDP performance, RDP connection problems, strange errors and even BSOD, remote computers freezing or restarting after initiation of a remote session. In a lot of this cases the quick solutions made b…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

914 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

19 Experts available now in Live!

Get 1:1 Help Now