Hello,
Response from Receive-Job contains some errors and I want to capture those in variable for some reason those are missing from variable but do output to screen when required. Example is below. I’d like $resp variable to contain error message as well, not only “Server1 processing finished”
PS C:\Users\admin>> $Sender | Receive-Job -Keep
The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], COMException
+ FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
+ PSComputerName : localhost
Server1 Processing finished
PS C:\Users\admin>> $resp = ($Sender | Receive-Job -Keep)
The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
+ CategoryInfo : InvalidOperation: (:) [Get-WmiObject], COMException
+ FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
+ PSComputerName : localhost
PS C:\Users\admin>> $resp
Server1 Processing finished