PowerShell and Group Policy Administration

Did you know that you can use PowerShell scripting to enhance the Group Policy administration? Me neither until I read the nice article "Simplifying Group Policy Administration with Windows PowerShell"

In this article you will discover how to use the GPMC API's to manage the GPO through Windows PowerShell. There is one example that really shows the power of PowerShell scripting. If you use that script, which I included below, you will have all GPO's that have been changed in the past 24 hours. Imagine how you should to this today with the tools you have available?

$gpmSearchCriteria = $gpm.CreateSearchCriteria()
# We want all GPOs so no search criteria will be specified
$gpmAllGpos = $gpmDomain.SearchGPOs($gpmSearchCriteria)
# Find all GPOs in the domain
foreach ($gpmGpo in $gpmAllGpos)
if ($gpmGpo.ModificationTime -ge (get-date).AddDays(-1)) {$gpmGpo.DisplayName}
# Check if the GPO has been modified less than 24 hours from now

This example script together with other scripts is available as a download

Comments (0)

Skip to main content