Avatar of Mark Lewis
Mark Lewis

asked on 

Help with copying a couple of existing AD fields to different fields for the same user with Powershell

I have been using a program for auto signatures locally that pulled information from the Description field and the PO Box field in my on premise AD and it worked great.

Now that we are going cloud based and the auto sig software pulls from Azure, some of my data is encapsulated in [" "] when it goes into the signature. I have found that storing the data in extensionAttribute 1 and extensionAttribute 2 works fine for Description and PO Box respectively but I have no idea how to copy the existing data from one to the other and I have hundreds of users. I have found some scripts on Google but I want to make sure I dont screw up the data in my AD. 
PowershellActive Directory

Avatar of undefined
Last Comment
oBdA
Avatar of 🔐 Peter GEELEN
🔐 Peter GEELEN
Flag of Belgium image

Don't you have a test environment setup?
Else better clone a DC in an isolated test VM and test the scripts.

BTW, you can run powershell with a whatif statement and test the script
https://docs.microsoft.com/en-us/powershell/module/activedirectory/set-aduser?view=windowsserver2019-ps
Avatar of Mark Lewis
Mark Lewis

ASKER

With 300 users on a hosted environment that charges me to set up new VM's, no I do not have a test environment and cant just spin up a VM. Thanks for the link although if I was competent at PS, I wouldnt be asking for help. Thanks
Variation on the sample script in the Set-ADuser page, to set a target attribute with a source attribute value

$User = Get-ADUser -Identity JohnDoe -Properties SourceAttribue
$User.targetAttribute= $User.SourceAttribute
Set-ADUser -Instance $User

And you can easily list the target users in a textfile or CSV file, load the file, and run a loop through the user set
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Blurred text
THIS SOLUTION IS 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
Active Directory
Active Directory

Active Directory (AD) is a Microsoft brand for identity-related capabilities. In the on-premises world, Windows Server AD provides a set of identity capabilities and services, and is hugely popular (88% of Fortune 1000 and 95% of enterprises use AD). This topic includes all things Active Directory including DNS, Group Policy, DFS, troubleshooting, ADFS, and all other topics under the Microsoft AD and identity umbrella.

86K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo