Wednesday, October 6, 2010

GPO Scripts – Reporting on All GPOs in a Domain


There are a significant number of times in an administrator's career when it is nice to be able to view all of the GPOs affecting a domain at a single glance. Some examples that quickly jump to mind are:
  • Starting a job with a new company
  • Consulting for a new customer
  • Discovery phase of a recent acquisition
Here is a Powershell script from the Technet Script Center that happens to be from an administrator of a customer that fills the bill on being able to produce an HTML report of all GPOs in a domain.
To use, simply replace your domain for the text "your.domain.here" in the script. Note: for this script to work you need the Group Policy Management Feature installed on your computer.Enjoy.

# Script By: Jonathan Knapp#
# Replacement for GPOTOOL.EXE (Windows Resource Kit Tool)
#
#


$results1 = Test-Path C:\GPOReports


# Create folder


if ($results = "False") {
New-Item C:\GPOReports -type directory -Force
}
else {
}


$results2 = Test-Path C:\GPOReports\GPOReportsGUID.html


# Create empty file


if ($results = "False") {
New-Item C:\GPOReports\GPOReportsGUID.html -type file -force
}
else {
}


Import-Module -Name grouppolicy


Get-GPOReport -All -Domain Your.domain.Here -Server DC01 -ReportType HTML -Path C:\GPOReports\GPOReportsAll.html


# now View in IE


Invoke-Item C:\GPOReports\GPOReportsAll.html

No comments:

Post a Comment