Skip to content

Importing PSCustomObject changes its PSTypeName #10843

@mm6502

Description

@mm6502

Type of issue

Missing information

Feedback

I cannot find any mention, that using this cmdlet on previously serialized PSCustomObject will change its PSTypeName (itwill be prefixed with 'Deserialized.'.

Proof:

$original = [PSCustomObject] @{ PSTypeName = 'before' }
$original.PSObject.TypeNames
$original | Export-CliXml -Path 1.xml
$deserialized = Import-CliXml -Path 1.xml
$deserialized.PSObject.TypeNames

Output:

before
System.Management.Automation.PSCustomObject
System.Object
Deserialized.before
Deserialized.System.Management.Automation.PSCustomObject
Deserialized.System.Object

Page URL

https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/import-clixml?view=powershell-7.4

Content source URL

https://github.com/MicrosoftDocs/PowerShell-Docs/blob/main/reference/7.4/Microsoft.PowerShell.Utility/Import-Clixml.md

Author

@sdwheeler

Document Id

0a2e8234-2bd0-2875-7728-78edca932a48

Metadata

Metadata

Assignees

Labels

area-utilityArea - Microsoft.PowerShell.Utility module

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions