Advertisement
guyrleech

Show AD GPO Link Count & Versions per GPO

Sep 13th, 2022
1,582
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Import-Module -Name GroupPolicy
  2.  
  3. Get-GPOReport -ReportType Xml -Path C:\GPOs.xml -All
  4.  
  5. [xml]$gpos = Get-Content -Path C:\gpos.xml
  6.  
  7. ## change Out-GridView to Export-CSV to save to csv file
  8.  
  9. $gpos.report.gpo|select-object Name,*Time,@{n='Links';e={if( $_.PSObject.Properties[ 'LinksTo' ] ) { ($_.LinksTo|Measure-Object).Count } else { '-' }}},@{n='Computer Enabled';e={$_.Computer.Enabled}},@{n='Computer Version';e={[int]$_.Computer.VersionDirectory}},@{n='User Enabled';e={$_.User.Enabled}},@{n='User Version';e={[int]$_.User.VersionDirectory}} | Out-GridView
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement