Kae Travis

Use PowerShell to Search Group Policy for a Specific Setting

Posted on by in PowerShell
Tags:

This is a simple one-liner enabling us to use PowerShell to search Group Policy for a specific setting.

It’s always frustrating when we can’t find which policy a particular configuration is coming from.  An example is trying to find a policy containing specific registry, or a logon script, or a scheduled task, or a shortcut name, or a specific configuration specified in an ADMX.

Use PowerShell to Search Group Policy for a Specific Setting

This simple example searches all group policy objects for a script called “alkane.ps1” – it could be part of a login script, startup script, scheduled task, file copy or otherwise!

$searchString = "alkane.ps1"
Get-GPO -All | Where-Object { $_ | Get-GPOReport -ReportType xml | Select-String $searchString } | select DisplayName, ID

We can search for any string of text.  But we will need a local installation of RSAT and an elevated account to run it!

Search Group Policy for a Specific Setting
Use PowerShell to Search Group Policy for a Specific Setting

Leave a Reply