Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 214
  • Last Modified:

Script to Update user accounts

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
smithandandersen
Asked:
smithandandersen
  • 2
1 Solution
 
TMekeelCommented:
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
 
sovworkerCommented:
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
 
sovworkerCommented:
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

Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now