Run PowerShell script to multiple servers remotely

  • List all servers (better FQDN or IP) in a txt file name "servers.txt".
  • Keep the PowerShell script (say script.ps1) at the same location as the text file.
$server=Get-Content C:\servers.txtInvoke-Command -ComputerName $server -FilePath C:\script.ps1

Comments