Solved

Script to Update user accounts

Posted on 2013-05-23
3
206 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
  • 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Do you have users whose passwords are expiring and they are constantly calling you?  Well I sure did and needed a way to put an end to this.  We have a lot of remote users which would not be notified that their passwords were expiring since they wer…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
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 …

785 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