- September 7, 2016 at 6:24 am #53638
I am getting the below error, when I try to import the file.
PS D:\> import-clixml -path d:\process.xml
Import-Clixml : Data at the root level is invalid. Line 2, position 1.
At line:1 char:14
+ import-clixml <<<< -path d:\process.xml + CategoryInfo : NotSpecified: (:) [Import-Clixml], XmlException + FullyQualifiedErrorId : System.Xml.XmlException,Microsoft.PowerShell.Commands.ImportClixmlCommandSeptember 7, 2016 at 6:33 am #53645
What's in that file? Was it created by the Export-Clixml cmdlet? If it's just a general XML file, don't use Import-Clixml. Do this instead:
[xml](Get-Content d:\process.xml)September 7, 2016 at 6:37 am #53647
I had used out-file to export the file in xml. So if I dont use export file, I should not use import-clixml? Please clarify
gps |out-file d:\process.xmlSeptember 7, 2016 at 6:39 am #53653
If you used Out-File, then it's not really an XML file at all, regardless of what file extension you gave it. 🙂 It'll just be a text file containing a table or list (whatever you'd have seen at the console if you hadn't piped to Out-File.)
Export-Clixml and Import-Clixml are paired commands; the import reads files created by the export.
You could have done this:
gps | Export-Clixml d:\process.xml # and later: Import-Clixml d:\process.xmlSeptember 7, 2016 at 6:46 am #53664
Thank so much for the explanation!!It helped 🙂
You must be logged in to reply to this topic.