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?

Thanks!
_________________________
Gus Dalinis Systems Analyst

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

Registered: 2003-01-28
Posts: 4396
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.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

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

Registered: 2003-04-19
Posts: 4545
Loc: USA
This is one too: GetUserDN() - http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=188576#Post188576


There are a couple of different variations... look here: UDF Forum - http://www.kixtart.org/forums/ubbthreads.php?ubb=postlist&Board=7&page=1

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

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

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

$strUserOU=Split($strUserDN,"OU=")
$strUserOU[0]=""
$strUserOU=Join($strUserOU,"OU=")

$strComputerOU=Split($strComputerDN,"OU=")
$strComputerOU[0]=""
$strComputerOU=Join($strComputerOU,"OU=")


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

Exit 0

Top
#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

Top
Page 1 of 1 1


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

Who's Online
0 registered and 507 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 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:
Google
Web kixtart.org