Page 1 of 1 1
Topic Options
#196474 - 2009-10-26 06:05 PM Query Computer OU
gdalinis Offline
Fresh Scripter

Registered: 1999-12-07
Posts: 27
Looking for a script to query what OU a computer is part of. Basically, want to write a script that says if a user is logging into a computer that belongs to the 'lab' OU, they will get blah blah blah. Is this possible?

Gus Dalinis Systems Analyst

#196475 - 2009-10-26 06:37 PM Re: Query Computer OU [Re: gdalinis]
Glenn Barnas Administrator Offline
KiX Supporter

Registered: 2003-01-28
Posts: 4370
Loc: New Jersey
GetObjectOU() will do this - it's available from the Resources / Kix Function Library page on my web site.

It can return the DN string for a User or Computer. You can then do an InStr() to determine if the desired OU is in the DN string.

Actually I am a Rocket Scientist! \:D

#196478 - 2009-10-26 06:48 PM Re: Query Computer OU [Re: Glenn Barnas]
Allen Administrator Online   shocked
KiX Supporter

Registered: 2003-04-19
Posts: 4534
Loc: USA
This is one too: GetUserDN() -

There are a couple of different variations... look here: UDF Forum -

#196484 - 2009-10-27 08:43 AM Re: Query Computer OU [Re: Allen]
Richard H. Administrator Offline

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Or just rip it straight out of ADSystemInfo.
Break ON

$objSysInfo = CreateObject("ADSystemInfo") 
$strComputerDN = $objSysInfo.computerName 
$strUserDN = $objSysInfo.userName 



"Information from ADSystemInfo"+@CRLF
"           User DN: "+$strUserDN+@CRLF
"    User container: "+$strUserOU+@CRLF
"       Computer DN: "+$strComputerDN+@CRLF
"Computer container: "+$strComputerOU+@CRLF

Exit 0

#196514 - 2009-10-28 09:13 PM Re: Query Computer OU [Re: Richard H.]
gdalinis Offline
Fresh Scripter

Registered: 1999-12-07
Posts: 27
Hey all, didn't realize this thread got moved. Just saw the responses. Give me a day to reply back so I can play around with the responses I got. Thanks all.
Gus Dalinis Systems Analyst

Page 1 of 1 1

Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 294 anonymous users online.
Newest Members
MacduMela, karimKix, NicoK, Kelly001, MichaelK72
17776 Registered Users

Generated in 0.052 seconds in which 0.023 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google: