Enable-GphLocalStore.ps1
#Requires -RunAsAdministrator function Enable-GphLocalStore { <# .SYNOPSIS Sets the Default Policy Template Store to %windir%\PolicyDefinitions .DESCRIPTION When the Group Policy Editor is started, it searches for a Central Policy Store by Default, which is located on each Domain controller inside the Sysvol-Share. This Cmdlets sets the local Store as default, so the Group Policy Editor will always start with local Policy Templates. .EXAMPLE Enable-GphLocalStore Sets %windir%\PolicyDefinitions as the Default Store for Policy Templates. Gpedit will load the local Templates after you called this Cmdlet. .NOTES Author: Holger Voges Date: 2018-11-16 Version: 1.0 #> [cmdletbinding()] param() If ( (Get-OsVersion).Versionnumber -lt 6.3 ) { Throw 'Switchting between Localstore and Globalstore needs at Least Windows 8.1' } $LocalStoreKey = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Group Policy\' Try { If (-not ( test-path -Path $LocalStoreKey )) { $null = New-Item -Path $LocalStoreKey $Null = New-ItemProperty -Path $LocalStoreKey -Name ENABLELOCALSTOREOVERRIDE -PropertyType DWord -Value 1 } Else { Set-ItemProperty -Path $LocalStoreKey -Name ENABLELOCALSTOREOVERRIDE -Value 1 } Write-Verbose "$LocalStoreKey set to 1" } Catch { Write-Error $_.Exception.Message } } |