Making change in the policy is not time consuming but to find all policy on which you need to make this change is really complicated and too time consuming.
Being a powershell lover, i created a script which will help you to get the list of all GPOs as per your passed string and its status whether it is linked or not.
#*==========================================================================================================================*# # Serach GPOs by String #*==========================================================================================================================*# # Script Created By : Ashish Gupta # Date : 6th January 2018 # Organisation : Freelance # Description : This script will fetch all GPOs as per the string you pass in the script. Then it will check # its all Links and their status # OS Requirement : Windows Server 2012 R2 and Windows Server 2016 #*==========================================================================================================================*# # Define variables #*==========================================================================================================================*# Import-Module -Name GroupPolicy $search = Read-Host -Prompt "Enter the string you want to search for?" $DomainName = $env:USERDNSDOMAIN Write-Host "Going to search '$search' string in all GPOs......" -ForegroundColor Cyan -BackgroundColor Black #*==========================================================================================================================*# # Fetching all GPOS and match the string in each and every GPO. #*==========================================================================================================================*# Write-Host "Fetching all GPOs......" -ForegroundColor Cyan -BackgroundColor Black $GPOs = Get-GPO -All -Domain $DomainName Write-Host "All GPOs have been fetched of $DomainName domain. Searching for the string '$search'......" -ForegroundColor Cyan -BackgroundColor Black Foreach ($GPO in $GPOs){ $XMLReport = Get-GPOReport -Guid $GPO.Id -ReportType xml $GPODisplayName = $GPO.DisplayName if ($XMLReport -match $search) { [xml]$linkto = Get-GPOReport $GPO.Id -ReportType xml $propertise = @{'GPOName'=$GPODisplayName; 'LinksTo'= $LinkTo.GPO.LinksTo.SOMPath;} $object = New-Object -TypeName psobject -Property $propertise Write-Output $object } } #*==========================================================================================================================*# # End of the Script. #*==========================================================================================================================*#
Note : If you are confused which string to use to find all related GPOs. It would be good, if you select a GPO in which you have the string, open it in XML and see the setting on which you need to work. Select a unique string and use the same in the script.
Thank you
0 comments:
Post a Comment