Serialization converts an in-memory object or data structure into a transferable representation. In PowerShell remoting, output objects become XML, travel across the network, and are deserialized back into objects on your computer. section 13.1.3
Deserialized remote objects are useful, but they have important limits:
- They are snapshots of the moment when the remote objects were generated; values such as CPU usage and memory usage do not update automatically. section 13.1.3
- They are not fully functional remote objects, so you cannot directly instruct one to perform an action such as stopping itself. section 13.1.3
- Complete filtering and other processing remotely whenever possible, then transmit only the results needed for display or reporting. section 13.7.2
Filter before serialization
Invoke-Command -HostName SRV2,DC3,SRV4 -ScriptBlock { Get-Process pwsh -UserName tylerl | Where-Object {$_.Parent.ProcessName -like '*term*'} } filters on each remote computer before serializing the remaining results. Filtering after Invoke-Command transmits unnecessary data and can leave local commands unable to identify the original remote object. section 13.7.2
Invoke-Command -HostName SRV2,DC3,SRV4
-ScriptBlock { Get-Process pwsh -UserName tylerl |
Where-Object {$_.Parent.ProcessName -like '*term*'}}
Compare the remote filtering placement in a working Invoke-Command pipeline. section 13.7.2























