I am working on a script to install software to remote PCs, and I ran into an issue I have never experienced before. I am trying to pass in the file name to Start-Process as a variable, but for some reason it does not like this, and hangs on the install. It will just sit indefinitely. The log file shows that this creates shows that the process terminated unexpectedly.
Invoke-Command -ComputerName $ComputerName -ScriptBlock { Start-Process msiexec "/i c:\$FileName /lvx* c:\PackageManagement.log" -wait }
$FileName is test.msi which exists on the target computers C: drive as I copied it there.
I have tried using Powershell joins, I have tried using concat, I have tried setting the Start_Process command to it's own variable and using that. It just hangs. The computer is on, connected to the internet. When I replace $FileName in the code above with test.msi directly, it installs just fine.