Solved

AD 2012 Move Atrribute Mobile Phone to Pager

Posted on 2016-07-22
6
71 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 40

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
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 
LVL 1

Author Comment

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

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

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Always backup Domain, SYSVOL etc.using processes according to Microsoft Best Practices. This is meant as a disaster recovery process for small environments that did not implement backup processes and did not run a secondary domain controller that ne…
A hard and fast method for reducing Active Directory Administrators members.
This tutorial will walk an individual through the process of configuring basic necessities in order to use the 2010 version of Data Protection Manager. These include storage, agents, and protection jobs. Launch Data Protection Manager from the deskt…
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.

617 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