I'm a newbie to powershell. I am working on a script which is not starting the service intermittently.
$sensuresult = Start-Process -Wait -FilePath $filepath -ArgumentList '/tasks="assocfiles,modpath" /quiet' -PassThru
Basically here we are trying to install a .msi package. Intermittently the above line fails.
Write-Host $sensuresult
Write-Host : The following exception occurred while retrieving the string: "Process has exited, so
the requested information is not available."
At line:8 char:1
+ Write-Host $sensuresult
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Host], ExtendedTypeSystemException
+ FullyQualifiedErrorId :
ToStringPSObjectBasicException,Microsoft.PowerShell.Commands.WriteHostCommand
With the above error message I really do not know if Start-Process failed or Write-host.
Can I get some insights on why Start-Process is not installing the package intermittently and what is the best alternative way to do this.