PowerShell set the manager on users

I came up with the idea that if we set the “manager” on a user in AD, the users can look at resources, and see who the owner is.

The manager seems like a natural attribute to look at…..

In outlook when I look at the user (resource) in the Global Address list I see this.

The Manager of extest5 is quest migrator (and it displays the full name, not the user id)

This will be my “input file”

So we want to set the resource Manager in AD,

Let’s learn!

So I set it manually in ADUC (on the left) and look at the attribute on the right in ADSIEDIT.MSC

So I do some googling, I search for set manager attribute PowerShell

and I find that quest makes some extensions for active directory that are FREE and make my life easy. Oh, like Free beer, it’s free and it makes my life easy…. Or a little more relaxing… LOL.

You can look at this later, but this is it. http://www.quest.com/powershell/activeroles-server.aspx

So I download and install on a workstatation, that already has the PowerShell and Exchange 2007 management tools installed…. So this download adds this tool.

This gives me this shell prompt, nice blue…

So, I ran this command (I got to know this from googling)

Sure enough, Manager is the attribute, cool.

So let’s set one…. See if that works. I know extest4 is empty (I ran the above command and the Manager field was blank…. Or in the world of PowerShell we call that $null)

Sure enough, that was easy…. Oh boy, am I glad I don’t have to put in the Distinguished Name (DN) and I just can call out the userid (SamAccountName)

So I took one of my other PowerShell commands and built this:

NOTE that it says Resource-OwnerTest.csv, I took the big file and made one small entry to test it (I would hate to mess things up on 600 plus resources)

SPECIAL NOTE: I MADE SURE THERE WERE NO EMPTY LINES, OR THE COMMAND WILL GRAB ALL USERS AND SET LOTS OF ERRORS WILL OCCUR.

It worked!

Now I do it on all the users, this is the output

There were a few errors, for example, the one you see, is really Blahblha_SR (note the underscore)

I’ll find the errors, fix the list and re-run.

The only errors I can’t fix at this point is this:

Advertisements

About Mike

owner of blog
This entry was posted in Active Directory, PowerShell. Bookmark the permalink.

One Response to PowerShell set the manager on users

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s