Deserialization converts transmitted XML back into objects that PowerShell can work with. During remoting, a computer serializes command output into XML, sends it across the network, and the receiving computer deserializes it. section 13.1.3
Treat deserialized objects as snapshots, not live remote objects. Process values such as memory and CPU usage reflect the moment they were generated, and the objects cannot perform actions such as stopping themselves. section 13.1.3
Use deserialized results carefully when processing remote data:
- Complete filtering and other processing on the remote computer whenever possible, then transmit only the results you need. section 13.7.2
- Expect local handling after Invoke-Command to display or store results, rather than to operate on the original remote resources. section 13.7.2
Filter remotely before deserialization
Invoke-Command -HostName SRV2,DC3,SRV4 -ScriptBlock { Get-Process pwsh -UserName tylerl | Where-Object {$_.Parent.ProcessName -like '*term*'} } places the filtering inside the remote script block. The smaller result is then serialized, transmitted, and deserialized locally. section 13.7.2
Invoke-Command -HostName SRV2,DC3,SRV4
-ScriptBlock { Get-Process pwsh -UserName tylerl |
Where-Object {$_.Parent.ProcessName -like '*term*'}}
Compare remote filtering with local filtering to see how script-block placement controls transmitted data. section 13.7.2









