Note: I'm using ConvertTo-XML, and cannot use Export-Clixml.
I create a simple PSObject:
$a = New-Object PSObject -Property @{ Name='New' Server = $null Database = $null UserName = $null Password = $null } I then convert it into XML using ConvertTo-XML:
$b = $a | Convertto-XML -NoTypeInformation The XML looks like this:
<?xml version="1.0"?> <Objects> <Object> <Property Name="Password" /> <Property Name="Name">New</Property> <Property Name="Server" /> <Property Name="UserName" /> <Property Name="Database" /> </Object> </Objects> I'm having trouble figuring out the dot notation or XPath query to extract the attributes/elements and convert $b back to the original PSObject.