Solved

active directory script

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

This is my 3rd article on SCCM in recent weeks, the 1st (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/Windows_Server_2008/A_4466-A-beginners-guide-to-installing-SCCM2007-on-Windows-2008-R2-Server.html) dealing with installat…
Welcome to my series of short tips on migrations. Whilst based on Microsoft migrations the same principles can be applied to any type of migration. My first tip Migration Tip #1 – Source Server Health can be found here: http://www.experts-exchang…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

773 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