![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | export-clixml and compare-object question I'm trying to compare a "living" object with one imported using import-clixml, but compare-object is not seeing them as identical. See code: PS ps:\> $g = gwmi -class win32_desktop PS ps:\> export-clixml -path desktop.xml -input $g PS ps:\> $h = import-clixml desktop.xml PS ps:\> PS ps:\> compare-object $g $h InputObject SideIndicator ----------- ------------- @{__GENUS=2; __CLASS=Win32_Desktop; __SUPERCLA... => \\COMPUTERONE\root\cimv2:Win32_Desktop.Name="N... <= @{__GENUS=2; __CLASS=Win32_Desktop; __SUPERCLA... => \\COMPUTERONE\root\cimv2:Win32_Desktop.Name="N... <= @{__GENUS=2; __CLASS=Win32_Desktop; __SUPERCLA... => @{__GENUS=2; __CLASS=Win32_Desktop; __SUPERCLA... => @{__GENUS=2; __CLASS=Win32_Desktop; __SUPERCLA... => @{__GENUS=2; __CLASS=Win32_Desktop; __SUPERCLA... => @{__GENUS=2; __CLASS=Win32_Desktop; __SUPERCLA... => \\COMPUTERONE\root\cimv2:Win32_Desktop.Name="N... <= \\COMPUTERONE\root\cimv2:Win32_Desktop.Name="c... <= \\COMPUTERONE\root\cimv2:Win32_Desktop.Name="S... <= \\COMPUTERONE\root\cimv2:Win32_Desktop.Name="S... <= \\COMPUTERONE\root\cimv2:Win32_Desktop.Name=".... <= My expectation was that Compare-Object would see the $g and $h as the same since $h is just the XML representation of $g written out with export-clixml and reimported with import-clixml. Am I missing something or my understanding of export/import-clixml totally off-base? gaurhoth |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: export-clixml and compare-object question I did meet Gaurhoth on IRC (#PowerShell on freenode) and answered it there, but the workaround to get all properties ( -property parameter does not support wildcards ) might be usefull for more people, so I repost it here : <mow002> as one is seralized they are different <mow002> PoSH>$g | gm <mow002> TypeName: System.Management.ManagementObject#root\cimv2\Win32_Desktop <mow002> PoSH>$h | gm <mow002> TypeName: Deserialized.System.Management.ManagementObject#root\cimv2\Win32_Desktop <mow002> I found this trick to do a check on all properties (-property does not support wildcards) <mow002> compare-object $g $h -prop ($g |% {"$($_.psbase.properties | select name)"}) Greetings /\/\o\/\/ "Gaurhoth" <gaurhoth@live.com> wrote in message news:%23m9%23Z8FJHHA.3668@TK2MSFTNGP02.phx.gbl... I'm trying to compare a "living" object with one imported using import-clixml, but compare-object is not seeing them as identical. See code: PS ps:\> $g = gwmi -class win32_desktop PS ps:\> export-clixml -path desktop.xml -input $g PS ps:\> $h = import-clixml desktop.xml PS ps:\> PS ps:\> compare-object $g $h InputObject SideIndicator ----------- ------------- @{__GENUS=2; __CLASS=Win32_Desktop; __SUPERCLA... => \\COMPUTERONE\root\cimv2:Win32_Desktop.Name="N... <= @{__GENUS=2; __CLASS=Win32_Desktop; __SUPERCLA... => \\COMPUTERONE\root\cimv2:Win32_Desktop.Name="N... <= @{__GENUS=2; __CLASS=Win32_Desktop; __SUPERCLA... => @{__GENUS=2; __CLASS=Win32_Desktop; __SUPERCLA... => @{__GENUS=2; __CLASS=Win32_Desktop; __SUPERCLA... => @{__GENUS=2; __CLASS=Win32_Desktop; __SUPERCLA... => @{__GENUS=2; __CLASS=Win32_Desktop; __SUPERCLA... => \\COMPUTERONE\root\cimv2:Win32_Desktop.Name="N... <= \\COMPUTERONE\root\cimv2:Win32_Desktop.Name="c... <= \\COMPUTERONE\root\cimv2:Win32_Desktop.Name="S... <= \\COMPUTERONE\root\cimv2:Win32_Desktop.Name="S... <= \\COMPUTERONE\root\cimv2:Win32_Desktop.Name=".... <= My expectation was that Compare-Object would see the $g and $h as the same since $h is just the XML representation of $g written out with export-clixml and reimported with import-clixml. Am I missing something or my understanding of export/import-clixml totally off-base? gaurhoth |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Formatting Inline for Export-CliXML Command | Brandon Shell | PowerShell | 14 | 09-18-2007 10:56 PM |
| Export/Import-CliXml oddity | Keith Hill | PowerShell | 1 | 02-11-2007 04:01 AM |
| Testing object arrays using Compare-Object and -contains | Alex K. Angelopoulos [MVP] | PowerShell | 2 | 08-31-2006 05:57 PM |
| Export-CliXml/Export-Csv: Change to Export-Object? | Alex K. Angelopoulos [MVP] | PowerShell | 3 | 06-04-2006 07:57 PM |
| Adding canonical aliases for Compare-Object, Measure-Object, New-Object | Alex K. Angelopoulos [MVP] | PowerShell | 2 | 05-26-2006 07:58 AM |