I want to apologize if I'm not using the right terminology... please correct me.
I have an XML file that I need to parse through to get some data. One of the first things I need to do is get the version of the xml file and compare it with another XML file's version in a remote location.
To start, I'm already able to get the version of each file with the following code:
[xml]$LHotFixes=Get-Content"E:\Fixes.xml"
$LocalXML=$LHotFixes.WSU.HDR | Select Version
Returns:
Version
--------
3.1.4
$LocalXML=$LHotFixes.WSU.HDR | Select Version
Returns:
Version
--------
3.1.4
How do I go about comparing the versions? My code seemed to barf all over me.
$CompareXML=Compare-Object ($RemoteXML.SelectNodes("/WSU/HDR") | Select-objectSelect-Object-Expand Name) ($LocalXML.SelectNodes("/WSU/HDR") | Select-Object-Expand Name)
Any suggestions? Been searching but not finding anything.. and or not using the right search terms.
A question, My code above that returns the value... What if I only wanted to get the value and not the Version with the value under it? Possible? Get-Member showed the following:
PS C:\temp> $LHotFixes.WSU.HDR | Select Version |get-member-force
TypeName: Selected.System.Xml.XmlElement
Name MemberType Definition
------------------------
pstypenames CodeProperty System.Collections.ObjectModel.Collection`1[[System.String, mscorlib, Version=4.0.0.0, Cult..
psadapted MemberSet psadapted {ToString, Equals, GetHashCode, GetType}
psbase MemberSet psbase {ToString, Equals, GetHashCode, GetType}
psextended MemberSet psextended {Version}
psobject MemberSet psobject {BaseObject, Members, Properties, Methods, ImmediateBaseObject, TypeNames, get_Bas..
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Version NoteProperty System.String Version=3.1.4
TypeName: Selected.System.Xml.XmlElement
Name MemberType Definition
------------------------
pstypenames CodeProperty System.Collections.ObjectModel.Collection`1[[System.String, mscorlib, Version=4.0.0.0, Cult..
psadapted MemberSet psadapted {ToString, Equals, GetHashCode, GetType}
psbase MemberSet psbase {ToString, Equals, GetHashCode, GetType}
psextended MemberSet psextended {Version}
psobject MemberSet psobject {BaseObject, Members, Properties, Methods, ImmediateBaseObject, TypeNames, get_Bas..
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Version NoteProperty System.String Version=3.1.4
Thanks!