

To verify the data types of two variables above ( $Geography and $GeographyXML) we can always use Get-Member PowerShell CmdLet and run the following lines of the code: $Geography | Get-Member $GeographyXML | Get-Member The difference between the two calls is that first will as a result return String data type into PowerShell variable and later uses the type accelerator and returns XML document data type as a result which is more convenient for working with XML documents since we get XML methods to do so. $GeographyXML = (Get-Content -Path 'C:\Temp\XMLdemo.xml') $Geography = Get-Content -Path 'C:\Temp\XMLdemo.xml' Here is the sample code for that solution. Well, one of the solutions is to use Get-Content CmdLet instead of Import-Clixml CmdLet that is failing as we have seen.

How to read such XML files and get the XML document in PowerShell to further manipulate it.

NOTE: Look at the tags of the two XML files and notice that sample XML file (XMLdemo.xml) is missing some tags created by Export-Clixml CmdLet(Objs, Obj, TN, etc.). Import of sample XML file fails using Import-Clixml CmdLet
