Skip to content

Instantly share code, notes, and snippets.

Created June 2, 2017 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/59bc54ba14e74d2a88ba64d824099f4c to your computer and use it in GitHub Desktop.
Save anonymous/59bc54ba14e74d2a88ba64d824099f4c to your computer and use it in GitHub Desktop.
[xml]$xml = @"
<?xml version="1.0"?>
<Audithardware InstallSource="VMWare vSphere" Type="HW" dataID="DataExtract" Version="4.4" creationTime="2017-06-02T20:40:26.9704605+12:00">
<OU>
<computer />
<computer Vrt="Data Center" Name="Example" />
<computer Vrt="Physical" Name="" PH="Example_Cluster" RAM="34156351488" SP="5230635" Typ="Server" OS="VMware ESXi 5.5.0" CCore="4" CPhys="1" CThr="8" CLog="8" CNme="Intel(R) Xeon(R) CPU E3-1245 V2 @ 3.40GHz" mke="LENOVO" mdl="L
enovo ThinkServer TS130" Mhz="3313" />
<computer Vrt="Physical" Name="" PH="Example_Cluster" RAM="68450557952" SP="5050593" Typ="Server" OS="VMware ESXi 6.0.0" CCore="6" CPhys="1" CThr="12" CLog="12" CNme="Intel(R) Xeon(R) CPU E5-2620 v3 @ 2.40GHz" mke="HP" mdl="Pro
Liant ML110 Gen9" Mhz="2341" />
<computer Vrt="Virtual" Name="Server1" PH="192.168.1.252" RAM="2147483648" Clog="6" />
<computer Vrt="Virtual" Name="Server2" PH="192.168.1.252" RAM="796917760" Clog="1" />
<computer Vrt="Virtual" Name="W0002" PH="192.168.1.252" RAM="2147483648" Clog="1" />
</OU>
</Audithardware>
"@
($xml.Audithardware.OU.computer | Where-Object {$_.Vrt -eq "Virtual"}).RemoveAll()
$xml.OuterXml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment