-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
It should be clarified that serialization and deserialization also happens in the following contexts, in addition to remoting:
- background jobs (child-process-based jobs created with
Start-Job
, not thread-based ones created withStart-ThreadJob
/ForEach-Object -Parallel
) - calling the CLI with a script block from within PowerShell (e.g.,
pwsh -c { Get-Item / }
)
However, the remoting-related properties such as PSComputerName
aren't added in these scenarios.
Re section "DISPLAYING THE MACHINENAME PROPERTY":
It should be clarified that the per-cmdlet, DCOM-based remoting supported by some cmdlets (with their own -ComputerName
parameter) in Windows PowerShell is no longer supported in PowerShell Core - in PowerShell Core, these cmdlets never had -ComputerName
parameters.
Re section "DESERIALIZED OBJECTS":
However, the deserialized object is not a live object. It is a snapshot of the object at the time that it was serialized, and it includes properties but no methods.
This is true for most reference types and most non-primitive value types.
The set of well-known types that deserialize type-faithfully is in the MS-PSRP (PowerShell remoting) protocol, which the topic should at least link to.
Some object types, such as DirectoryInfo objects and GUIDs, are converted back into live objects when they are received.
DirectoryInfo
instances (and FileInfo
instances) are not converted back to live objects - they cannot be.
Enumerating the full set of well-known types - those that deserialize type-faithfully - directly in this topic would be helpful.
Non-type-faithfully-deserialized objects, which are [pscustomobject]
instances, reflect the type of origin in their hidden .pstypenames
property, as also reported by Get-Member
.
Specifically, the original type name and its inheritance chain are recreated with prefix Deserialized.
To illustrate this with a deserialized DirectoryInfo
type:
PS> (Start-Job { Get-Item / } | Receive-Job -Wait -AutoRemoveJob).pstypenames
Deserialized.System.IO.DirectoryInfo
Deserialized.System.IO.FileSystemInfo
Deserialized.System.MarshalByRefObject
Deserialized.System.Object
When objects are not formatted, all of the properties of each object appear in the console in a streaming list.
It would be helpful to clarify that this means that Format-List
formatting is implicitly applied, but you're free to pipe to Format-Table
instead, for instance.
Or, you can use the Out-GridView cmdlet to display the objects in a table.
Worth noting that Out-GridView
is currently only available in Windows PowerShell.
Also worth clarifying that serialization / deserialization is also performed when sending values to remotely executing script blocks / script blocks in child-process-based background jobs (Start-Job
), as input / arguments, as discussed in about_Remote_Variables
(which is already linked to in the "SEE ALSO" section, but without context).
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 73b2d19f-4be4-f8d7-7e39-451d2c4ad59f
- Version Independent ID: 1911c1b0-1d2d-28c9-9ca1-09af6e445bac
- Content: about_Remote_Output - PowerShell
- Content Source: reference/6/Microsoft.PowerShell.Core/About/about_Remote_Output.md
- Product: powershell
- Technology: powershell-cmdlets
- GitHub Login: @SteveL-MSFT
- Microsoft Alias: slee