title: How to run Powershell on a list of computers
body: <p>I'm trying to run a remote command on a list of computers that available in plain text file (1 computer per line) in a file named <code>1.txt</code> available under <code>c:\1\1.txt</code>.</p>
  
  <p>What I run the powershell script the variable <code>$comp</code> is being run as <code>$comp</code> instead of being changed to the computer name</p>
  
  <pre><code>$computers = Get-Content c:\1\1.txt
  
  foreach ($comp in $computers){
  $LicenseInfo = Get-WmiObject SoftwareLicensingProduct -ComputerName $comp | Where-Object { $_.partialProductKey -and $_.ApplicationID -eq "55c92734-d682-4d71-983e-d6ec3f16059f" } | Select-Object PartialProductKey, Description, ProductKeyChannel, @{ N = "LicenseStatus"; E = { $lstat["$($_.LicenseStatus)"] } } 
  echo $LicenseInfo, $comp
  }
  </code></pre>
  
  <p>run the powershell command with the Computername <code>$comp</code> - where <code>$comp</code> will be changed everytime in the loop for another name of a computer available in the <code>c:\1\1.txt</code> file</p>