bklockwood / PSWU

PowerShell Windows Update. CLI/scripted windows updates!
MIT License
24 stars 2 forks source link

Win7 systems don't return output from invoke-command #26

Closed bklockwood closed 8 years ago

bklockwood commented 8 years ago

This is blocking forward progress, and baking my noodle.

I place the following function on t7 (a Win7/PS v2 system):

function test-remoteicm {
    [CmdletBinding()]
    Param ()
    $true
    write-output "hello"
}

I run it from a win8.1 or win10 machine thusly:

PS> icm t7 {import-module pswu;test-remoteicm}

PS> icm t7 {import-module pswu;test-remoteicm;$null}
True
hello

PS> icm t7 {$null;import-module pswu;test-remoteicm}
True
hello

PS> 

There's no output on the local machine without a $null sent in the invoke-command scriptblock. Why?

The same invoke-command experiment will work fine if the target is a Win10, Win2012r2, or Win8.1 system.

bklockwood commented 8 years ago

Resolved with this stupid workaround:

PS> icm t7 {import-module pswu; $output = test-remoteicm; $output}
True
hello

PS>