I am trying to install software remotely on many machines in our domain. I have the file on a remote share and it copies down locally and then installs it. The problem I am having is the script hangs on the install part and never actually starts the install from what I can see in task manager and with where the directory should be created. Any help would be much appreciated.
Variables
$computername = Get-Content ‘C:Pathmachines.txt’ $sourcefile = “ServerFile.exe”
This section will install the software
foreach ($computer in $computername) { $destinationFolder = “$computerC$Temp” #It will copy $sourcefile to the $destinationfolder. If the Folder does not exist it will create it.
if (!(Test-Path -path $destinationFolder)) { New-Item $destinationFolder -Type Directory } Copy-Item -Path $sourcefile -Destination $destinationFolder Invoke-Command -ComputerName $computer -ScriptBlock {Start-Process 'C:tempFile.exe' -ArgumentList '/S' -Wait}
}
submitted by /u/dantheman5606
[link] [comments]
The post Run exe install remotely appeared first on How to Code .NET.