Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populate Telephone # in AD

Status
Not open for further replies.

Encino40

MIS
Apr 6, 2012
19
CA
Is there a way to auto populate that field if I had a CSV file with the username and telephone #?
 
Yes, it's actually very simple. Use import-csv powershell command and pipe that into set-user command.

I am not sure how your shell skills are, let us know if you need help further.
 
My shell skills are not good. Can you give me an example of what the script would look like?

TIA
 
Then your shell skills need to get better. Like a LOT of people are saying, you either learn and love PowerShell, or you find another line of work.
Assuming your users.csv has two columns, "account" and "phone":

Code:
if (import-module activedirectory){
$users = import-csv users.csv
foreach ($user in $users){
	Set-ADUser $user.account -OfficePhone "$user.phone"
}
}

There is no logging or error checking there. You should add some. You should also normalize the phone numbers to E.164 format.

Do you have your Tek-Tips.com Swag? I've got mine!

Stop by the new Tek-Tips group at LinkedIn.
 

Yea I know but scripting is not my thing. I just can't seem to wrap my head around it. In the CSV file do I just need the username and telephone number or do I need something specific?
TIA
 
The .csv file should have the top header row with "account" and "phone"
And then one line for each user, with their account name and phone number.

Do you have your Tek-Tips.com Swag? I've got mine!

Stop by the new Tek-Tips group at LinkedIn.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top