title: How to query Active Directory for a domain user via powershell without installing RSAT tools on client computer
body: <p>I've search around on the internet for a way to query Active Directory for a user via powershell (or cmd) without installing RSAT tools but nothing has worked. My script needs to query AD to confirm that the user exists before moving on to the next step. The computer is on the domain and Ideally, i don't want my script to download and install RSAT tools on the client workstation. </p>
  
  <p>I was able to get the following code to work. However, I have to be logged in as a domain user. Ideally, I would like this to work from a local admin user on a workstation that is bound to AD.</p>
  
  <pre><code>$search = [adsisearcher]"(&amp;(ObjectCategory=Person)(ObjectClass=*)(cn=*))"
  $users = $search.FindAll()
  foreach($user in $users) 
  {
      $CN = $user.Properties['CN']
      $DisplayName = $user.Properties['DisplayName']
      $SamAccountName = $user.Properties['SamAccountName']
      "CN is $CN"
      "Display Name is $DisplayName"
      "SamAccountName is $SamAccountName"
  } 
  </code></pre>