Solved

Powershell - Add "+45" to Phonenumbers in AD

Posted on 2013-06-13
6
305 Views
Last Modified: 2013-06-13
Hi,

I want to add "+45" to the existing phonenumber on all our users in AD, so a users phone number changes to "+45 #and their existing number#".

How can this be done with powershell?

Thanks in advance!
0
Comment
Question by:Sum Wum
  • 2
  • 2
  • 2
6 Comments
 
LVL 37

Expert Comment

by:Neil Russell
ID: 39243679
Assuming that the phone number is stored in a variable called $phoneNumber.....

$phoneNumber = "+45 $phonenumber"

Will do it.
0
 
LVL 1

Author Comment

by:Sum Wum
ID: 39243683
Is there a way to do this quickly to all our users with powershell?
0
 
LVL 42

Expert Comment

by:sedgwick
ID: 39243694
Get-ADUser -Filter * -Properties HomePhone | % {Set-ADUser $_ -HomePhone ("+45"+$_.HomePhone)}

Open in new window

0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
LVL 42

Accepted Solution

by:
sedgwick earned 500 total points
ID: 39243695
if u need users under specific OU use -SearchBase, for eample:
Get-ADUser -Filter * -SearchBase 'OU=HumanResources,OU=UserAccounts,DC=FABRIKAM,DC=COM'  -Properties HomePhone | % {Set-ADUser $_ -HomePhone ("+45"+$_.HomePhone)}

Open in new window

0
 
LVL 37

Expert Comment

by:Neil Russell
ID: 39243707
Or using Quest QAD Commandlets....

Get-QADUser | % { Set-QADUser $_ -PhoneNumber "+45 $($_.phonenumber)" }
0
 
LVL 1

Author Closing Comment

by:Sum Wum
ID: 39243722
Couldn't ask for a better answer :)
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

While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
This article runs through the process of deploying a single EXE application selectively to a group of user.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
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…

856 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