cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Convert .ndi files to csv?

Anyone have an suggestions on how to do this?   Have have classified labs that need to scrub the .ndi files before they can send over to the non-classified area.    They want to see the ndi file as a CSV file. 

(5) Replies

I would suggest to pull resolved inventory data from inventory database and save it as CVS that will quicker and better option.

Other option is to parse ndi XML to csv e.g. in the example below it is snippet of hardware class from ndi XML. you can pull in the following format in the CSV. It mean you need separate different type of evidence within the CSV that is why i am suggesting pulling from the database will be easier option.

ClassName, ClassNameValue, PropertyName, PropertyValue, Source 

Win32_ComputerSystem, ABCDEFGH, Manufacturer, VMware, Inc., WMI

<Hardware Class="Win32_ComputerSystem" Name="ABCDEFGH" Evidence="WMI">
<Property Name="Manufacturer" Value="VMware, Inc."/>
<Property Name="Model" Value="VMware Virtual Platform"/>
<Property Name="Domain" Value="MY.Domain"/>
<Property Name="DomainRole" Value="3"/>
<Property Name="NumberOfProcessors" Value="2"/>
<Property Name="NumberOfLogicalProcessors" Value="2"/>
<Property Name="TotalPhysicalMemory" Value="8589463552"/>
<Property Name="Status" Value="OK"/>
</Hardware

 

Cheers,
Aamer

The .ndi files are in XML format.  There is likely some 3rd-party tools that can read/parse the XML into another format such as CSV or Excel.

@ChrisTittiger 

If you Google 'powershell convert xml to csv' you'll find many PowerShell examples...

Thanks,

mfranz
By Level 17 Champion
Level 17 Champion

Hi,

You could just rename the file to .csv and you had a CSV file. But you'll probably have not much fun with the output. In order to  make any sense, you would have to reserve a column for each type and attribute in the xml to make any sense.

Maybe you'll have more luck parsing the xml objects in PowerShell.

Best regards,

Markward

I don't have any easy answer for you here, but can perhaps help to explain why what you're trying to do here is difficult:

CSV files are suited for showing tabular data. However inventory data held in NDI files is a reasonably rich hierarchical format using an XML syntax, so I don't think you will find it easy to represent the data in a tabular CSV form. (In general it is possible and common to represent tabular data in XML format, which can be converted to CSV syntax fairly easily as mentioned in other responses here - but that won't help for NDI files where the data is not tabular in nature.)

If you really wanted to try, one approach may be to consider develop an XML transform to transform all the different elements and attributes found in NDI XML files to a tabular structure - but I expect that would involve more work than you are thinking of here.
(Did my reply solve the question? Click "ACCEPT AS SOLUTION" to help others find answers faster. Liked something? Click "KUDO". Anything expressed here is my own view and not necessarily that of my employer, Flexera.)