How to work with errors in RestrictedLanguage mode of remote session?


I have a module which is imported into WinRM session which is in RestrictedLanguage mode. I need to get ErrorOutput stream from following command

$output = Receive-job * -ErrorVariable RemoteErr

This does not work since in RestrictedLanguage mode this variable is not allowed and fails with error below

A variable that cannot be referenced in restricted language mode or a Data section is being referenced. Variables that can be referenced include the following: $PSCulture, $PSUICulture, $true, 
$false, and  $null.

Short of switching Remote Session configuration to ConstrainedLanguage what are my options?

You don’t have any. What it’s doing is exactly what it’s supposed to do, and it’s kinda not designed to provide a workaround.

Well I need to get all the errors which happened on remote jobs, be it on job itself (like it was unable to connect to remote computer or something happened within job itself while it was running and -ErrorVariable provided handy access to this.
Job istself is like this

$job = Invoke-Command -ComputerName $computerNames -ScriptBlock $scriptBlock -AsJob 

Now to use JEA in the way it was intended (actually in NoLanguage mode) I have to figure out how to properly let function know that there were exceptions down the line. It seems to be workaround is below but I don’t think it’s very good, what are suggestions?

foreach ($childJob in $job.ChildJobs) {
			if ($childJob.State -eq "Failed") {
			$script:Globalerror += @{ Name = $childJob.Location; Error = $childjob.JobStateInfo.Reason}
			elseif ($childJob.Error -ne $null) {
			$script:Globalerror += @{ Name = $childJob.Location; Error = $childjob.Error}