< Back
Get-PSFTypeSerializationData
Post
NAME Get-PSFTypeSerializationData
SYNOPSIS
Creates a type extension XML for serializing an object
SYNTAX
Get-PSFTypeSerializationData [[-InputObject] <Object[]>] [[-Mode] <String>] [-Fragment] [[-Serializer] <String>]
[[-Method] <String>] [<CommonParameters>]
DESCRIPTION
Creates a type extension XML for serializing an object
Use this to register a type with a type serializer, so it will retain its integrity across process borders.
This is relevant in order to have an object retain its type when ...
- sending it over PowerShell Remoting
- writing it to file via Export-Clixml and reading it later via Import-Clixml
Note:
In the default serializer, all types registered must:
- Have all public properties be read & writable (the write needs not do anything, but it must not throw an
exception).
- All non-public properties will be ignored.
- Come from an Assembly with a static name (like an existing dll file, not compiled at runtime).
PARAMETERS
-InputObject <Object[]>
The type to serialize.
- Accepts a type object
- The string name of the type
- An object, whose type will then be determined
Required? false
Position? 1
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-Mode <String>
Whether all types listed should be generated as a single definition ('Grouped'; default) or as one definition
per type.
Since multiple files have worse performance, it is generally recommended to group them all in a single file.
Required? false
Position? 2
Default value Grouped
Accept pipeline input? false
Accept wildcard characters? false
-Fragment [<SwitchParameter>]
By setting this, the type XML is emitted without the outer XML shell, containing only the <Type> node(s).
Use this if you want to add the output to existing type extension xml.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-Serializer <String>
The serializer to use for the conversion.
By default, the PSFramework serializer is used, which should work well enough, but requires the PSFramework to
be present.
Required? false
Position? 3
Default value PSFramework.Serialization.SerializationTypeConverter
Accept pipeline input? false
Accept wildcard characters? false
-Method <String>
The serialization method to use.
By default, the PSFramework serialization method is used, which should work well enough, but requires the
PSFramework to be present.
Required? false
Position? 4
Default value GetSerializationData
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Get-PSFTypeSerializationData -InputObject 'My.Custom.Type'
Generates an XML text that can be used to register via Update-TypeData.
RELATED LINKS
SYNOPSIS
Creates a type extension XML for serializing an object
SYNTAX
Get-PSFTypeSerializationData [[-InputObject] <Object[]>] [[-Mode] <String>] [-Fragment] [[-Serializer] <String>]
[[-Method] <String>] [<CommonParameters>]
DESCRIPTION
Creates a type extension XML for serializing an object
Use this to register a type with a type serializer, so it will retain its integrity across process borders.
This is relevant in order to have an object retain its type when ...
- sending it over PowerShell Remoting
- writing it to file via Export-Clixml and reading it later via Import-Clixml
Note:
In the default serializer, all types registered must:
- Have all public properties be read & writable (the write needs not do anything, but it must not throw an
exception).
- All non-public properties will be ignored.
- Come from an Assembly with a static name (like an existing dll file, not compiled at runtime).
PARAMETERS
-InputObject <Object[]>
The type to serialize.
- Accepts a type object
- The string name of the type
- An object, whose type will then be determined
Required? false
Position? 1
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-Mode <String>
Whether all types listed should be generated as a single definition ('Grouped'; default) or as one definition
per type.
Since multiple files have worse performance, it is generally recommended to group them all in a single file.
Required? false
Position? 2
Default value Grouped
Accept pipeline input? false
Accept wildcard characters? false
-Fragment [<SwitchParameter>]
By setting this, the type XML is emitted without the outer XML shell, containing only the <Type> node(s).
Use this if you want to add the output to existing type extension xml.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
-Serializer <String>
The serializer to use for the conversion.
By default, the PSFramework serializer is used, which should work well enough, but requires the PSFramework to
be present.
Required? false
Position? 3
Default value PSFramework.Serialization.SerializationTypeConverter
Accept pipeline input? false
Accept wildcard characters? false
-Method <String>
The serialization method to use.
By default, the PSFramework serialization method is used, which should work well enough, but requires the
PSFramework to be present.
Required? false
Position? 4
Default value GetSerializationData
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Get-PSFTypeSerializationData -InputObject 'My.Custom.Type'
Generates an XML text that can be used to register via Update-TypeData.
RELATED LINKS