title: How to retrieve data using a SQL query that takes a list of users stored in a powershell variable as input?
body: <p>I have a list of Ids in the $netid variable from the below powershell script:</p>
  <pre><code>$netid =Get-ADGroupMember ADGROUPSAMPLE1 | select accountname
  </code></pre>
  <p>Which stores the following in the variable:</p>
  <pre class="lang-none prettyprint-override"><code>accountname
  ===========
  User1
  User2
  User3
  </code></pre>
  <p>I have a SQL Server database table which has mapping between the netid and their workstation name.</p>
  <pre class="lang-none prettyprint-override"><code>User  |Machinename
  ------------------
  User1 |laptop1 
  User2 |laptop2 
  User3 |laptop3 
  </code></pre>
  <p>I'm new to powershell and thus need help with a powershell script that can help me pull the laptop names from the database for all the ids stored in the $netid variable. SQL Server version is SQL Server 2014.</p>