I am trying to get an application to install on a remote server using powershell. Here is the script I am using:
$cred = Get-Credential
$s = New-PSSession -ComputerName $ServerName -Credential $credInvoke-Command -Session $s -ScriptBlock {Start-Process -FilePath "c:\windows\system32\msiexec.exe" -ArgumentList "/i \\computer\e$\installer.msi /qn" -Wait}
Remove-PSSession -ComputerName $ServerName
If I run the following on the remote computer directly, it executes beautifully:
Start-Process -FilePath "c:\windows\system32\msiexec.exe" -ArgumentList "/i \\computer\e$\installer.msi /qn" -Wait
But when I run it remotely as a part of the Invoke-Command, the PS Session is opened, the script runs, msiexec starts on the remote computer, then the PS Session closes but the application never installs and msiexec never closes.
Any help would be appreciated.
Thanks,
Zach