Reputation: 137
I have a script to copy a file to remote servers C:\temp and also to execute the exe file remotely. But the problem here is, it is copying .exe file to c:\temp of the remote machine, but not executing the exe.
Can anyone help me to correct here ?
ForEach ($Computer in Get-Content C:\scripts\servers.txt)
{
Copy-Item -Path '\\serverA\c$\scripts\Firefox Setup 52.0.1.exe' -Destination \\$Computer\c$\temp\;
Invoke-Command -AsJob -ComputerName $Computer -ScriptBlock { & "C:\temp\Firefox Setup 52.0.1.exe -ms" }
}
Upvotes: 0
Views: 959
Reputation: 672
Try this, Step by step breif explation is given for Installing-remote-software using Powershell
Upvotes: 1