parsing XML file…

by Jan 21, 2012

So this is my XML report from NMAP:

<?xml version="1.0" encoding="utf-8" ?>

<nmaprun scanner="nmap" args="nmap -F –script=smb-os-discovery –script=nbstat -oX c:\NMAP\Temp2\result3.xml" start="1327070530" startstr="Fri Jan 20 09:42:10 2012" version="5.51" xmloutputversion="1.03">
  <scaninfo type="syn" protocol="tcp" numservices="100" />
  <verbose level="0" />
  <debugging level="0" />
<host starttime="1327070531" endtime="1327070537">
  <status state="up" reason="echo-reply" />
  <address addr="" addrtype="ipv4" />
  <hostname name="" type="PTR" />
  <script id="nbstat" output="NetBIOS name: test, NetBIOS user: <unknown>, NetBIOS MAC: 00:00:00:00:00:00 (USI) Names OF060L3A0760X<00> Flags: <unique><active> OF060L3A0760X<20> Flags: <unique><active> TEST<00> Flags: <group><active> TEST<1e> Flags: <group><active> TEST<1d> Flags: <unique><active> x01x02__MSBROWSE__x02<01> Flags: <group><active>" />
  <script id="smb-os-discovery" output="OS: Windows XP (Windows 2000 LAN Manager) Name: TESTtest System time: 2012-01-20 09:41:19 UTC-5" />
I know how to get all the information from, but I need only MAC, OS and Name nothing else….. and somehow to create table with all 3 items and | export-csv
Thanks in advance