Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 254
  • Last Modified:

simple script code to find organizational unit

does anyone know of a simple piece of code for a login script on windows server 2008 that will find which organizational unit the person is placed in?  I have ou such as manager, itstaff, tellers, accounting.  I know how to ask what computer they are logging into and who they are, but asking for their OU is escaping me.

gary
0
javagair
Asked:
javagair
  • 3
  • 2
  • 2
2 Solutions
 
motnahp00Commented:
Out of curiosity, why are you not using the Object tab in ADUC?
0
 
Joseph DalyCommented:
The following command ran from any domain controller or any computer with Active directory users and computers installed will tell you the location.

dsquery user -samid "username"
0
 
javagairAuthor Commented:
either I don't understand you you don't understand what I'm doing.  When one of the domain users in another town logins in the morning I assign them network drives.  Each OU such as managers gets different mapped drives than say a secretary; but I don't want to have enough switch cases for 110 employees.  I would just like to have 8 cases where if they belong to a certain OU then they get particular mapped drives.

gary
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
motnahp00Commented:
Create a GPO for drive mappings. You can apply this particular policy at the domain level if you like.

User Configuration -> Preferences -> Windows Settings -> Drive Maps -> New Mapped Drive

Action: Update
Location: \\server1\HR
Label as: HR
Drive Letter: X
Common tab -> Item-level targeting -> OU

Create a new drive map for each OU instance.

I hope this is what you are looking for.
0
 
Joseph DalyCommented:
Montnahp00 has the right answer. Group policy preferences will let you target the specific OU's that you want and apply the drive maps. Very easy solution to your issues.
0
 
javagairAuthor Commented:
I have windows xp pc mixed in with sys 7 and I am told that group policy drive mapping does not work for xp.  So I am back to a script.

gary
0
 
Joseph DalyCommented:
Group policy preferences work perfectly fine with windows XP. All they require are the client side extensions to be present on the computer. This update came out a fair amount of time ago so if you have been doing regular updating/patching they might already have it installed.

http://www.microsoft.com/download/en/details.aspx?id=3628
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now