title: VBS Retrieve Computer OU from AD and OU Case Statement to Perform Action
body: <p>I have this piece of code from the ScriptIT guys.</p>
  
  <pre><code>Set objSysInfo = CreateObject("ADSystemInfo")
  strComputer = objSysInfo.ComputerName
  Set objComputer = GetObject("LDAP://" &amp; strComputer)
  arrOUs = Split(objComputer.Parent, ",")
  arrMainOU = Split(arrOUs(0), "=")
  wscript.echo arrMainOU(1)
  </code></pre>
  
  <p>The problem I'm having is that arrMainOU(1) echoes the OU twice. I tried setting up a simple test, but it fails. I don't see this issue covered here or on google.</p>
  
  <pre><code>If arrMainOU(1) = "myOU" Then
  wcript.echo "true"
  End If
  </code></pre>
  
  <p>I need to compare 1 value within arrMainOU(1) to an array that contains OU strings. I need a case statement that performs actions depending on whether it's OU1 or OU2 and so on.</p>
  
  <p>I'm getting stuck at evaluating arrMainOU(1) though. If I output the value to a file, then it only writes one value.  </p>
  
  <p>Any help would be appreciated - Thank you</p>