Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

active directory script

Posted on 2014-09-12
5
Medium Priority
?
120 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 29

Assisted Solution

by:becraig
becraig earned 668 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 668 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 22

Assisted Solution

by:dan_blagut
dan_blagut earned 664 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

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

1. Boot PC and press F10, select storage options and change the compatibility from “AHCI” to “IDE”, save and exit 2. Boot PC and press F12 3. Upon PXE display of searching for DHCP server, press Pause break to obtain MAC address 3. Open Configu…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

730 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