title: Query Active Directory and Export using VBScript/WSH
body: <p>I want to query a AD server to get certain fields using VBScript or WSH script</p>
  
  <p>These fields</p>
  
  <blockquote>
    <ul>
    <li>DN</li>
    <li>userid</li>
    <li>mail</li>
    <li>company </li>
    <li>displayName </li>
    </ul>
  </blockquote>
  
  <p>And export/output the fields to a text file.</p>
  
  <p>How can I accomplish that?</p>
  
  <p>I came from linux background and need this as the computer that will run the script is running windows</p>
  
  <p>Using linux,</p>
  
  <pre><code>`ldapsearch -x -h hostserver -b "cn=contacts,dc=support,dc=com" CN="name"`
  </code></pre>