I'm trying to write a series of scripts to run discovery on a prospect or new
client's network. I'm familiar enough with WMI and Powershell to get
whatever data I want from a computer once I connect to it. But before that I
need to (1) discover the active NIC on my laptop (wireless? ethernet?) and
learn the network number (e.g., 192.168.1.0/24), then (2) scan the network to
find the active devices using something like NMAP, noting which devices are
Windows hosts, and finally (3) scan each Windows host and gather the hardware
and software inventory and store it to an XML file.
Right now I'm stuck handing off the data from step (2) to (3). I've got an
XML file that contains the active hosts. I just need to know how to read it.
Any help would be greatly appreciated.
The XML file looks like this. (I'm only interested in "status state='up'" ) :
<?xml version="1.0" ?>
<?xml-stylesheet href="nmap.xsl" type="text/xsl"?>
<!-- Nmap 4.21ALPHA4 scan initiated Thu Apr 19 23:42:31 2007 as: nmap -sP -R
-oX c:\myscan.xml 192.168.1.0/24 -->
<nmaprun scanner="nmap" args="nmap -sP -R -oX c:\myscan.xml 192.168.1.0/24"
start="1177044151" startstr="Thu Apr 19 23:42:31 2007" version="4.21ALPHA4"
xmloutputversion="1.01">
<verbose level="0" />
<debugging level="0" />
<host>
<status state="down" />
<address addr="192.168.1.0" addrtype="ipv4" />
</host>
<host><status state="up" />
<address addr="192.168.1.1" addrtype="ipv4" />
<address addr="00:13:10:34:29:37" addrtype="mac" vendor="Cisco-Linksys" />
<hostnames />
</host>
<host><status state="up" />
<address addr="192.168.1.2" addrtype="ipv4" />
<address addr="00:B0

0:61:3B

B" addrtype="mac" vendor="Dell Computer" />
<hostnames><hostname name="sbs2003.lancaster.local" type="PTR"
/></hostnames>
</host>