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

x
?
Solved

Script to Update user accounts

Posted on 2013-05-23
3
Medium Priority
?
212 Views
Last Modified: 2013-06-14
We are doing a phone system renumber that will change everyones extensions.
I have 300 users that all have the main company # + ext in the telephone field on the general tab of thier AD account.  I used csvde to export all the accounts to a csv in excel where I updated the extentions. Can anyone point me in the right direction as to the best way of updating AD accounts with the new exts???

TIA
0
Comment
Question by:smithandandersen
[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
  • 2
3 Comments
 
LVL 8

Expert Comment

by:TMekeel
ID: 39190580
There is a good example of this (look for nohandle's post) here:
http://powershell.com/cs/forums/t/11218.aspx

It should get you where you need to be, although the example is for folder creation.

You want to $objUser.Put("telephoneNumber", "xxx-xxx-xxxx") essentially, from a foreach statement modified from the two column csv that you have.
0
 
LVL 1

Accepted Solution

by:
sovworker earned 1500 total points
ID: 39192149
What version of windows are your DCs running, If they are running Windows server 2008, try this:

Create a CSV file with the following headings:

Identity, Phone

In the Identity column, put the users' logon names.  In the phone column, put the phone number in the desired format. Place your CSV file somewhere accessible where your powershell session can run it.

Then use this script:

$users = Import-csv 'location of your csv file'

Foreach ($user in $users)

{
Set-aduser -Identity $User.Identity -OfficePhone $User.Phone
}

Open in new window

0
 
LVL 1

Expert Comment

by:sovworker
ID: 39192155
If you are using Windows server 2003, you will need to download and instal the Quest Powershell AD cmdlets and use Set-QADUser rather than Set-ADUser...
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Uncontrolled local administrators groups within any organization pose a huge security risk. Because these groups are locally managed it becomes difficult to audit and maintain them.
After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

715 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