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

x
?
Solved

Powershell - Add "+45" to Phonenumbers in AD

Posted on 2013-06-13
6
Medium Priority
?
311 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:Meir Rivkin
ID: 39243694
Get-ADUser -Filter * -Properties HomePhone | % {Set-ADUser $_ -HomePhone ("+45"+$_.HomePhone)}

Open in new window

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 42

Accepted Solution

by:
Meir Rivkin earned 2000 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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

This process allows computer passwords to be managed and secured without using LAPS. This is an improvement on an existing process, enhanced to store password encrypted, instead of clear-text files within SQL
Wouldn't it be nice if objects in Active Directory automatically moved into the correct Organizational Units? This is what AutoAD aims to do and as a plus, it automatically creates Sites, Subnets, and Organizational Units.
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

916 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