Create Group Policy Reports

Windows Server 2008 R2 comes with the GroupPolicy PowerShell module. You might have to install that feature first before you can use it – run these lines with full Administrator privileges:

Import-Module ServerManager
Add-WindowsFeature GPMC

Once installed, the GroupPolicy module provides you with a lot of new cmdlets to manage group policy objects. Here’s a function that creates a nice HTML report for one or all group policies available in your domain:

function Show-GPOReport {
  param(
  $GPOName = $null,
  $filename = "$env:temp\report.hta"
  )

  Import-Module GroupPolicy
  if ($GPOName -eq $null) {
    Get-GPO -All | Select-Object -ExpandProperty DisplayName
  } else {
    Get-GPOReport -Name $GPOName -ReportType Html | Out-File $filename
    Invoke-Item $filename
  }
}

Twitter This Tip! ReTweet this Tip!


Posted Feb 17 2012, 06:00 AM by ps1
Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.