Command line attributes merge and append. Exporting to XML file

Started by Fiernaq

1) When saving the output from NetScan to a file, the second row is a bunch of ==== signs. Is there a way to remove that from the saved output?

2) When using the command line /merge attribute, is there a way to keep the headers intact?

Example:
netscan /range:192.168.1.20-192.168.1.30 /auto:test1.txt
followed by
netscan /append /merge /range:192.168.1.20-192.168.1.40 /auto:test1.txt

Doing this removes the headers from the top row because they are duplicated later on. The preferred method of merging would leave first line headers intact and remove the second set of headers as being duplicates while still treating the rest of the data the same as current.

3) Similar data: a computer has wired and wireless connected and the scan range covers both which brings in two rows of data. The Host Name will match and if you pull the serial number from WMI it will match as well but several columns such as IP Address, MAC Address and Response Time will be different. In fact, unless there's a better way of determining wired vs. wireless I was considering using the Response Time to make an educated guess (higher response time = wireless).

When appending and merging data, I'd like it if we were able to set columns that were relevant for determining whether a row is duplicate or not. For example, if we could type:
netscan /append /merge:2-3 /range:192.168.1.20-192.168.1.40 /auto:test1.txt
and if data in column 2 or 3 matched existing data (duplicate) then it would remove the earliest row but if data in other columns such as 1 or 4 or 5 matched existing data then it would simply append. I don't know, maybe there's a function that does this already built in.

4) XML. In my test file I used WMI to pull a few pieces of info such as the CPU, RAM, and Model # of the PC. When exporting to an XML file it stores that data like this:
<item>
	<ip-address></ip-address>
	<hostname></hostname>
	<mac-address></mac-address>
	<response-time></response-time>
	<logged></logged>
	<lastscan></lastscan>
	<snmp>
		<item/>
		<item/>
	</snmp>
	<services/>
	<registry>
		<item></item>
	</registry>
	<remfile/>
	<wmi>
		<item></item>
		<item></item>
		<item></item>
		<item></item>
		<item></item>
	</wmi>
	<membership>
		<item></item>
	</membership>
	<remxml/>
	<remperf/>
</item>

Note the WMI section specifically since it has several entries. In this case, every column is called the same thing inside the XML file: "Item". This makes importing into Excel a problem because WMI then becomes a list of lists. Would it be possible to set the XML fields based on the column names like this:
	<wmi>
		<CPU></CPU>
		<RAM></RAM>
		<Serial_Number></Serial_Number>
		<Asset_Tag></Asset_Tag>
		<Computer_Model></Computer_Model>
	</wmi>
As long as every XML field has its own name then Excel should be able to import it and create an XML map for handling.

Thanks for whatever assistance you can provide with these issues.
SoftPerfect Support forum - Andrew avatar image

Re: Command line attributes merge and append. Exporting to XML file   04 October 2014, 10:07

1) No. Use CSV instead. The text format is not designed for data interchange, while CSV is.

2) The problem with this is when NetScan does the merging, it has no way of knowing whether the first line is a header or not. That's why most third-party tools that can import text or CSV files have a tick box like 'First row contains the headings'. Even though we could make an educated guess by looking at the ===== signs when merging text, there is no way to do so when merging CSV.

3) There is a way to exclude multiple instances of the same computer, but it's not available on the command line. In the GUI you could use a filter (Ctrl + I) and filter, say, by Serial Number Unique as this will exclude entries whose values in the specified columns are duplicated.

4) This is a very good point! I have changed the behaviour and this new build writes named nodes instead.

Reply to this topic

Sometimes you can find a solution faster if you try the forum search, have a look at the knowledge base, or check the software user manual to see if your question has already been answered.

Our forum rules are simple:

  • Be polite.
  • Do not spam.
  • Write in English. If possible, check your spelling and grammar.

Author:

Email:

Subject

A brief and informative title for your message, approximately 4–8 words:

     

Spam prevention: please enter the following code in the input field below.

 ********  ********   **    **  **    **  **     ** 
    **     **     **   **  **   **   **    **   **  
    **     **     **    ****    **  **      ** **   
    **     ********      **     *****        ***    
    **     **     **     **     **  **      ** **   
    **     **     **     **     **   **    **   **  
    **     ********      **     **    **  **     ** 

Message: