Solved

Active DirectoryScript to change the Pager Field

Posted on 2016-11-23
1
63 Views
Last Modified: 2016-12-01
We use the Pager field as a reference for an internal process.  We need to now update the field with a new set of numbers.

Each user has a unique pre determined number.
The root user AD OU is OU=MyUsers,DC=company,DC=com
We have a mapping in a csv.  Not all user will get a PagerID, only the one in the files. Also it must replace (not merge) the PagerID field with new mapping.
Can
Usernames      PagerIDs
User1            12345
User2            12346
User3            12347


Is there Batch script that will to the following?
0
Comment
Question by:GGHC
1 Comment
 
LVL 83

Accepted Solution

by:
oBdA earned 500 total points
ID: 41899095
Powershell can do it easily:
Import-Module ActiveDirectory
Import-Csv C:\Temp\pager.csv | % {Set-ADUser -Identity $_.UserNames -Replace @{'pager' = $_.PagerIDs}}

Open in new window

0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

777 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