Avatar of akosinoah
akosinoah
 asked on

AD 2012 Move Atrribute Mobile Phone to Pager

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
PowershellActive DirectoryWindows Server 2012

Avatar of undefined
Last Comment
akosinoah

8/22/2022 - Mon
akosinoah

ASKER
Sorry i linked the old post i made for the same question.
XcelogiX

footech

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

This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
akosinoah

ASKER
Hi footech will this replicate the data from mobile phone to pager field?
ASKER CERTIFIED SOLUTION
footech

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
akosinoah

ASKER
Thanks