I've seen a few questions here about remoting with Get-Process and elements of the output that are not available when remoting, but I've seen no explanation for why those elements are not available when remoting. What is the answer to the latter question?
I've recently encountered this myself, though I'm able to access most the elements that folks here were asking about, StartTime, CPU among them. Here's my code and my issue:
$session = New-PSSession -ComputerName Foo
Invoke-Command -Session $session { Get-Process } | Export-Clixml FooProx.xml
$data = Import-Clixml FooProx.xml
$data | % { $_.Threads } | Select -First 2
System.Diagnostics.ProcessThread
System.Diagnostics.ProcessThread
This is not what I wanted. Locally I get:
Get-Process | Export-Clixml localprox.xml
$data = Import-Clixml localprox.xml
$data | % { $_.Threads } | select -First 2
BasePriority : 8
CurrentPriority : 9
Id : 5260
StartAddress : 8787569006056
ThreadState : Wait
WaitReason : UserRequest
Site :
Container :
BasePriority : 22
CurrentPriority : 22
Id : 3424
StartAddress : 8787569006056
ThreadState : Wait
WaitReason : UserRequest
Site :
Container :
I fully expect the response to be that this data is not available when using Get-Process remotely. Ok, buy why is that the case? And is there a way to get this data via WMI?
Thanks!