PowerTip: Use PowerShell Find all Enabled Group Policy Objects

PowerTip: Use PowerShell Find all Enabled Group Policy Objects

  • Comments 2
  • Likes

Summary: Use a Windows PowerShell cmdlet to find all enabled Group Policy objects in an Active Directory domain.

Hey, Scripting Guy! Question How can I easily find all enabled Group Policy objects in an Active Directory domain?

Hey, Scripting Guy! Answer Use the Get-Gpo cmdlet, specify the domain, and use the –all switch. Pipe the resulting objects to the Where-Object and look for a status that matches enabled. Note that ? is the alias for Where-Object.

The following is Windows PowerShell 3.0 syntax:

get-gpo -Domain iammred.net -all | ? gpostatus -match 'enabled'

The following is Windows PowerShell 2.0 syntax:

get-gpo -Domain iammred.net -all | ? { $_.gpostatus -match 'enabled'}

 

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Which module has the get-gpo cmdlet?

  • The Get-GPO cmdlet is part of the GroupPolicy module.