Solved

AD 2012 Move Atrribute Mobile Phone to Pager

Posted on 2016-07-22
6
45 Views
Last Modified: 2016-08-06
I'm trying migrate AD attributes from Mobile Phone to Pager field for all users accounts. but while running the code below im getting an error.

"A parameter cannot be found that matches parameter name 'pager'"

I have more than 300 users in AD last time it took me 1 day to manually add all the data.


$Users = Get-ADUser -Filter * -Properties MobilePhone,Pager

foreach ($user in $Users){
Set-ADUser -pager $User.mobilephone -whatif -verbose
}

Open in new window


Previous Post
0
Comment
Question by:akosinoah
  • 3
  • 2
6 Comments
 
LVL 1

Author Comment

by:akosinoah
ID: 41725541
Sorry i linked the old post i made for the same question.
0
 
LVL 1

Expert Comment

by:XcelogiX
ID: 41725554
0
 
LVL 39

Expert Comment

by:footech
ID: 41726517
Just because Set-ADUser doesn't have a parameter for pager doesn't mean it can't modify that attribute.  You can use the -Add, -Replace, -Clear, and -Remove parameters to modify any attributes (that aren't otherwise blocked) by referencing their ldap displayname.
Get-ADUser -Filter * -Properties MobilePhone,Pager | ForEach `
    $user = $_
    $user | Set-ADUser -Add@{pager = "$($user.mobile)"} -whatif -verbose
}

Open in new window

0
 
LVL 1

Author Comment

by:akosinoah
ID: 41729829
Hi footech will this replicate the data from mobile phone to pager field?
0
 
LVL 39

Accepted Solution

by:
footech earned 500 total points
ID: 41731506
Had a couple syntax errors.  It will copy the data.  It will not clear out the MobilePhone data, but that's easy enough to do later or even add the -Remove parameter to the below.
Get-ADUser -Filter * -Properties MobilePhone,Pager | ForEach `
{
    $user = $_
    $user | Set-ADUser -Add @{pager = "$($user.MobilePhone)"} -whatif -verbose
}

Open in new window

You would need to remove the -whatif parameter to run for real.  As with anything you should test before executing on production users.
0
 
LVL 1

Author Closing Comment

by:akosinoah
ID: 41745181
Thanks
0

Join & Write a Comment

The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This article will help you understand what HashTables are and how to use them in PowerShell.
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 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 …

762 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

21 Experts available now in Live!

Get 1:1 Help Now