Solved

Script to Update user accounts

Posted on 2013-05-23
3
209 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 500 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

Suggested Solutions

This article demonstrates probably the easiest way to configure domain-wide tier isolation within Active Directory. If you do not know tier isolation read https://technet.microsoft.com/en-us/windows-server-docs/security/securing-privileged-access/s…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

734 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