display RSOP XML security settings in Powershell for baseline comparisom

$xmlfile = "C:\share\dev.xml"
$xmldoc = New-Object System.XML.XMLDocument
$xmldoc.Load($xmlfile)

$xmldoc.Rsop.ComputerResults.ExtensionData.Extension |
Where-Object { $_.type -match 'SecuritySettings' } |
Select-Object -ExpandProperty UserRightsAssignment |
Select-Object -Property Name, @{
Name = 'Members'
Expression = { $_.Member.Name.'#text' -join ', ' }
}

Hi I am a new powershell user and just started training in XML. I am trying to display RSOP security settings in powershell so that I can export to CSV to do baseline comparison.

I managed to display the User Right Assignment part of the RSOP security settings, but i have difficulty display the folowing:

<strong>Security Settings\Local Policies\Audit Policy
Security Settings\Local Policies\Security Options
Security Settings\Event Log
Computer Configuration\Preferences\Windows Settings\Registry
Windows Settings\Advanced Audit Policy Configuration\Audit Policies\System</strong>

I can display password policy and password lockout policy using Get-ADDefaultDomainPasswordPolicy , but is it better to display it from RSOP XML output.

As for being new to PS, this is fine, we’ve all been there, but it is vital that you get yourself ramped up, to limit / avoid, many misconceptions, confusion, errors, bad habits, etc… that you are going to encounter.

YouTube, Microsoft Virtual Academy, MS Channel9, TechNet Virtual Labs are all free and you friend. Just search for PowerShell videos and / or labs on those resources.

Use the 'Free Resources' link in the left menu.

You can also leverage these Q&A resources.

https://www.reddit.com/r/PowerShell/comments/aw8cvk/course_to_increase_knowledge_of_windows/ehl4ixm/?context=3
https://www.reddit.com/r/PowerShell/comments/ausa1n/beginner_help/ehawij5/?context=3
https://www.reddit.com/r/PowerShell/comments/ar6cvt/powershell_in_depth_second_edition/egmlpom/?context=3
https://ww.reddit.com/r/PowerShell/comments/afqmmw/i_want_to_help_my_husband_advance_his_powershell/ee3k6p6/?context=3

And this…

https://blogs.msmvps.com/richardsiddaway/2019/02/21/the-source-of-powershell-cmdlets

There are XML cmdlets built into PSv2x and higher as well as modules you can install from the MS PowerShellGallery.
Using the .Net namespace is fine as well, yet get in the habit of starting with what is built in.

# See all XML modules
Find-Module -Name '*xml*'

# Download all XML module to target profile
Find-Module -Name '*xml*' | 
Format-Table -AutoSize | 
Save-Module -Path "$env:USERPROFILE\Documents\WindowsPowerShell\Modules"

# Install all XML modules
Install-Module -Name '*xml*'
Get-Command -Name '*xml*' | Format-Table -AutoSize

CommandType Name                      Version     Source
----------- ----                      -------     ------
...
Cmdlet      ConvertTo-Xml             3.1.0.0     Microsoft.PowerShell.Utility
...
Cmdlet      Export-Clixml             3.1.0.0     Microsoft.PowerShell.Utility
Cmdlet      Import-Clixml             3.1.0.0     Microsoft.PowerShell.Utility
...
Cmdlet      Select-Xml                3.1.0.0     Microsoft.PowerShell.Utility

With any properly formatted XML file. You should only need to do —

Import-CliXml -Path 'C:\share\dev.xml'
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/import-clixml

— and work with the displayed properties directly.