$ips = Get-Content -path "ips.txt" $password = "YOURPASSWORD" $user = "root" $command = "command.txt" foreach ($ip in $ips) { $remoteserver = $user+"@"+$ip Write-Output "yes" | PLINK.EXE -ssh $remoteserver -P 22 -pw $password -m $command }