• RSS
  • Twitter
  • FaceBook

Security Forums

Log in

FAQ | Usergroups | Profile | Register | RSS | Posting Guidelines | Recent Posts

Finding the OU that was logged into

Users browsing this topic:0 Security Fans, 0 Stealth Security Fans
Registered Security Fans: None
Post new topic   Reply to topic   Printer-friendly version    Networking/Security Forums Index -> Programming and More

View previous topic :: View next topic  
Author Message
ThePsyko
SF Mod
SF Mod


Joined: 17 Oct 2002
Posts: 16777178
Location: California

Offline

PostPosted: Fri Oct 30, 2009 11:52 pm    Post subject: Finding the OU that was logged into Reply with quote

I was troubleshooting an issue that I traced back to the OU.. while troubleshooting I threw together the following .vbs script to tell what OU the computer was in.. But then I started thinking - what if I didn't care what OU the system was in at the time, but what OU they actually logged into (i.e. which group policy was assigned)... if you run the following, move the computer to a new OU, then run it again, what is returned is the current OU that the system is actually in.

Code:
Option Explicit
On Error Resume Next

Dim objSysinfo, objUser

Set objSysInfo = CreateObject("ADSystemInfo")
Set objUser = GetObject("LDAP://" & objSysInfo.ComputerName)
'Set objUser = GetObject("LDAP://" & objSysInfo.UserName)

wscript.echo objUser.AdsPath


Granted, one will likely never have a need for such a script (after all, how often do you really change your system OUs ) but my curiosity has gotten the better of me so I'm curious if there is a way (similar to getting the logon server only for the OU)
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   

Post new topic   Reply to topic   Printer-friendly version    Networking/Security Forums Index -> Programming and More All times are GMT + 2 Hours
Page 1 of 1


 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Looking for more Windows Networking info?

Sign up to the WindowsNetworking.com Monthly Newsletter, written by Enterprise Security MVP Deb Shinder, containing news, the hottest tips, Networking links of the month and much more. Subscribe today and don't miss a thing!
View a sample newsletter.

Become a WindowsNetworking.com member!

Discuss your Windows Networking issues with thousands of other Windows Newtorking experts. Click here to join!

Community Area

Log in | Register

Readers' Choice

Which is your preferred data recovery solution?

Follow TechGenix on Twitter