API for remote Powershell deployment
(Warning in advance, PowerShell rookie here)
I have a PowerShell script that, when run from the target PC, will deploy a package from my PDQ server to the target using 'Invoke-Command'
It has 7 steps, installing various software. Most of the steps install flawlessly however, there is a step that occasionally fails and the PowerShell script isn't able to tell the user one of the steps failed. The script runs and shows completed whether or not the package was successfully installed.
Is there an API or some way for the PowerShell script to see the status of the package deployment and accurately report that to the user?