the computer name to the organizational unit in which it belongs.



Dim objSystemInfo, objNetwork, CurrentComputer
Dim strOu
Const OrgUnit = "OU=PCBMRDD"
Set objSystemInfo = CreateObject("ADSystemInfo")

Set CurrentComputer = GetObject("LDAP://" & objSystemInfo.ComputerName)
strOu = (Join(CurrentComputer.MemberOf))


If InStr(strOu, (OrgUnit)) Then
WScript.Echo "Hello"
End if
Wscript.Echo "Not found"
WScript.Quit

I am trying to use the computername of the PC and compare it to which
organizational unit belongs to. I am then going to map a drive based on the
organizational unit the PC belongs to and map it to a specific location.
When using the Echo statement after the GetObject statement I am able to
display all the active directory information for the ComputerName. When I
compile the code it will not check to see whether the computer name belongs
to a specific organizational unit.