BasicallyIm trying to run a powershell command from a list of machines.
I can invoke the command on each machine, but i have to wait for each machine to complete the installations before moving on to the next one. When I try creating a job for each machine nothing happens, i suspect its because my script has disconnected from that machines session when it send the command to the next machine.
#Start/Var
$creds = Get-Credential
$computers = Get-Content -Path .\computers.txt
$job = start-job -scriptblock { choco install c:\packages.config -y }
foreach($server in $computers) {
CP .\packages.config \\$server\C$
Invoke-Command -ComputerName $server -ScriptBlock {$job} -Credential $creds
}