Powershell - Batch Update AD User Object > Organization Tab > Manager > Name

I have over 80 users that I need to update their Manager's Name field in their AD User Object > Organization Tab > Manager Name

The users are in a txt and CSV file.

Is there a PS script that will process the update?
Mike DiasAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
You should just have combined that with your other "modifying" questions. I'm sure you do not want to add the same manager to all of those users?
It is usually better to give us the bigger picture in a single question, and let us decide whether it makes sense to split the question.
0
Mike DiasAuthor Commented:
You have a point,. It's a good point, I believed that splitting the question would be easier and less confusing. It sounds like I'm asking for a big bag.. and that might stop anyone assisting; whereas a smaller request might get answers.

I think I have a clue to this one.
https://4sysops.com/archives/configuring-ad-users-and-managers-with-powershell/

I need to script it.. if you have any ideas, let me know.
0
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
As you can see from the link, setting the Manager attribue for an user is easy. It is the logic which requires effort for bulk changes.

You already fooled me in https://www.experts-exchange.com/questions/29065282 by not providing any details, leading to "answering" the question yourself (using semi-optimal code).
I will refrain from providing suggestions as long as you do not show the (desired or real) input file. Or confirm whether it is indeed just a text file containing user names only, and you want to add the same manager (and in regard of https://www.experts-exchange.com/questions/29065280 the same job title).
0
Make Network Traffic Fast and Furious with SD-WAN

Software-defined WAN (SD-WAN) is a technology that determines the most effective way to route traffic to and from datacenter sites. Register for the webinar today to learn how your business can benefit from SD-WAN!

Mike DiasAuthor Commented:
Thanks. Apologies for any perceived misunderstandings and believe me, it wasn't intentional.

I do have a text file with usernames. I can't attach the real one; confidentiality aside, the whole story is that there are 85+ individuals in various OUs that I need to move into one OU. In this process, I need to update their "manager" and "job title." Once I have these users in the OU, I need to apply two or three GPOs to them.

That's the whole background.

I truly felt that if I broke this request into segments, it would be easier for anyone who reviewed the issue. I found one method parts thereof, however there are times that I need to only perform one aspect and not all of the segments, i.e. just update a number of user's manager etc. This is where the split was most beneficial to me.

Again. I apologize for any misunderstandings. I also sincerely thank you for assisting me in the past, with advice and actual code. Your work and understanding is by far top notch.
0
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
So, you want to move those same users into a single fixed OU, change to the same manager and job title?

You didn't respond in https://www.experts-exchange.com/questions/29065283/Powershell-Batch-Locate-AD-User-Object-Object-Tab.html, so I cannot be certain my assumptions posted there about the file format are correct, but I'll just assume so. Amd that means:
$manager = 'ManAger'    # samAccountName of Manager
$jobtitle = 'Developer'
$group = 'GIT_GS_AMU_Windows7_Object '
$userfile = 'C:\Temp\EE\Users.txt'

Get-Content $userfile |
  % { Get-ADUser $_ } |
  Set-ADUser -Manager $manager -JobTitle $jobtitle -PassThru |
  Add-ADPrincipalGroupMembership -MemberOf $group

Open in new window

This should satisfy the other two questions
https://www.experts-exchange.com/questions/29065282/Powershell-Batch-Update-AD-User-Object-Member-Of-Tab.html
https://www.experts-exchange.com/questions/29065280/Powershell-Batch-Update-AD-User-Object-Organization-Tab-Job-Title.html
You can add -Department and whatever you want to do the same with for those users. Just add or remove options and parameters for different cases.

Usually you want to bulk change users by filling out an Excel sheet, creating a CSV file or similar, and provide each attribute to change in that file, because it is seldom you want to apply the same change for all. Hence my original approaching might seem to be overcomplicated, but it is important to see behind what is posted by a question author ;-).
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mike DiasAuthor Commented:
Good answer! Thanks. Explanation helped.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.