?
Solved

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

Posted on 2008-06-12
6
Medium Priority
?
202 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 1500 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
Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

 
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

DFW AZURE MEETUP TONIGHT FRI 6PM

We will be discussing what Azure Stack is, how does it fit into the suit of offerings that Azure has currently, and where can it fit into your organizations technology stack. We will also be discussing limitations of the platform while covering various applicable scenarios.

Question has a verified solution.

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

Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
Microsoft Office 365 is a subscriptions based service which includes services like Exchange Online and Skype for business Online. These services integrate with Microsoft's online version of Active Directory called Azure Active Directory.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

801 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