title: Powershell Script for AD Users SID
body: <p>I currently use this script to obtain the SID of a user from AD. Not that each time I need an SID, I have to open the script and type the persons username in, which when I have 100's to do can be frustrating. The current script is as follows:</p>
  
  <pre><code>    $name = "username"
  (New-Object System.Security.Principal.NTAccount($name)).Translate([System.Security.Principal.SecurityIdentifier]).Value
      $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
  </code></pre>
  
  <p>Is there a way that I can use the same script but put the AD usernames in a textfile and pull them into powershell and have the output come out like so I get the username and the SID. Ideally into CSV format?</p>
  
  <p>Cheers,</p>