What are you having a problem with?

This should give you the OU of the local computer (unable to test)...
 Code:
$computer = CreateObject("ADSystemInfo").ComputerName
$objComputer = GetObject("LDAP://"+$computer)
$OU = Split(Split($objComputer.Parent,",")[0],"=")[1]

You can then just check against that.

http://blogs.technet.com/b/heyscriptingg...belongs-to.aspx


Edited by ShaneEP (2012-08-04 05:25 AM)