Solved

request help obtaining the site ou on local computers using either vba or CLI interface

Posted on 2008-06-12
6
200 Views
Last Modified: 2012-05-05
in multiple site domain, I need to write a login script that will identify the AD site ou that is assigned to the computer the user is signing in on.
0
Comment
Question by:Bmich71
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 2

Expert Comment

by:geedoubleu
ID: 21772207
If you are familiar with querying AD using VBScript you can grab the Users Distingusihed Name and then use Text functions to get the users OU.

Basically you search AD for the Users Logon name, create a User Object then query the user object for its distinguished name. The you can apply the spit function using , as the seperator to build an Array.
0
 

Author Comment

by:Bmich71
ID: 21772267
I have this;
Sub Determine_Site
  Set oADsSysInfo = CreateObject("ADSystemInfo")
  SITE = oADsSysInfo.SiteName
  Set oADsSysInfo = Nothing
End Sub

but it is not working.
0
 
LVL 2

Accepted Solution

by:
geedoubleu earned 500 total points
ID: 21772271
This should get you started...
Set objADInfo = WScript.CreateObject("ADSystemInfo")
strSite = objADInfo.SiteName
strUserDN = objADInfo.UserName
WScript.Echo strSite
WScript.Echo strUserDN

Open in new window

0
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 
LVL 2

Expert Comment

by:geedoubleu
ID: 21772292
Your code looks vaild, so there must be some other problem.

I'd look at your code that is using the variable SITE, I reckon there is a problem there.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 21775024
Hi, I have tested this:
  Set oADsSysInfo = CreateObject("ADSystemInfo")
  SITE = oADsSysInfo.SiteName
  Set oADsSysInfo = Nothing
  MsgBox SITE

and it returns the correct site...

Rob.
0
 

Author Closing Comment

by:Bmich71
ID: 31469975
Actually the answer I got, was correct for the question I possed, but it turns out the question I possed was in the wrong area to find the solution to my problem.  Thanks.
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
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.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

728 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