Solved

AD 2012 Move Atrribute Mobile Phone to Pager

Posted on 2016-07-22
6
50 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

OfficeMate Freezes on login or does not load after login credentials are input.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this Micro Tutorial viewers will learn how they can get their files copied out from their unbootable system without need to use recovery services. As an example non-bootable Windows 2012R2 installation is used which has boot problems.
In this Micro Tutorial viewers will learn how to restore their server from Bare Metal Backup image created with Windows Server Backup feature. As an example Windows 2012R2 is used.

867 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