Your strategic advantage starts here

Use Powershell to Search Group Policy for a Specific Setting

Use Powershell to Search Group Policy for a Specific Setting

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!

Related Posts
Leave a Reply
Give us a call

Available from 9am to 8pm, Monday to Friday.

Send us a message

Send your message any time you want.

Our usual reply time: 1 Business day
Give us a call

Available from 9am to 8pm, Monday to Friday.

Send us a message

Send your message any time you want.

Our usual reply time: 1 Business day