|
Curious to get you opinions on What I have so far. I'm using a UDF and modifying it to Look for a particular OU, and then go to that Section of the script.
Function GetComputerOU() Redim $TempArray[0] Redim $GetComputerOU $adSys = CreateObject("ADSystemInfo") $TempArray = Split($adSys.ComputerName,",") ; Check if there's a comma in the CN, eg if the user name = "Surname, Name" AD returns "Surname\, Name" If Right($TempArray[0],1) = "\" $Start = 2 Else $Start = 1 EndIf
For $Counter = $Start To UBound($TempArray) If Len($GetComputerOU) = 0 $GetComputerOu = $TempArray[$Counter] + Chr(10) Else $GetComputerOu = $GetComputerOu + "" + $TempArray[$Counter] + Chr(10) EndIf Next Chr(10) ? "--------------------For Each---------------------" + Chr(10)
For Each $Element In $TempArray If $Element = "OU=NA1" ? "Whoo Hoo!" GOTO Brazil ENDIF Next
$adSys = 0
Quit
:Troy ? "Entering TROY Script" GOTO END
:Brazil ? "Entering Brazil" GOTO END
:END quit
EndFunction GetComputerOU()
|