|
|
|||||||
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! |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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 |
||||||||
|
|
|||||||
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. |