Solved

Script to Update user accounts

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this article, we will see the basic design consideration while designing a Multi-tenant web application in a simple manner. Though, many frameworks are available in the market to develop a multi - tenant application, but do they provide data, cod…
Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
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 from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now