Jump to content

Recommended Posts

Posted

I'm trying to check all the exclusinos we have in McAfee and I'd like to export them into csv so I can compare what they acually are with what they are supposed to be. I have exported some settings which can only be done into xml file but I am trying to get it into a readable (csv or other) format. The structure is as follows:

.

.

.

.

.

 

What I want to be able to do is pull out the values for the ExcludedItems after the Section name "Server_Default-Exclusions".

 

I have been able to read the file using

$XmlDocument = Get-Content -Path $Path but what I can't seem to do is select the correct section.  I've tried $XmlDocument.SelectNodes but I just don't know how to get to the correct section name and pull out all the settings within that section.

 

Is this possible - or even an easier way to do this?

Posted

This might do what you want...

 

[xml]$XmlDocument = @"
<[color="#FF0000"]Section[/color]>
   <[color="#0000CD"]Section[/color] name="Server_Default-Exclusions">
       <[color="#EE82EE"]Setting[/color] name="ExcludedItem_0" [color="#FF0000"]value[/color]="exclusion1" />
       <[color="#EE82EE"]Setting[/color] name="ExcludedItem_1" [color="#FF0000"]value[/color]="exclusion2" />
   

"@

$XmlDocument.[color="#FF0000"]Section[/color].[color="#0000CD"]Section[/color].[color="#EE82EE"]Setting[/color] | Select-Object -ExpandProperty [color="#FF0000"]Value[/color]

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...