Skip to content

Instantly share code, notes, and snippets.

@Hexalon
Last active June 2, 2016 16:27
Show Gist options
  • Save Hexalon/c5b36017ae98088bc618e25a141c204d to your computer and use it in GitHub Desktop.
Save Hexalon/c5b36017ae98088bc618e25a141c204d to your computer and use it in GitHub Desktop.
Enables local GPO store override, creates the key if it does not exist.
#Requires -RunAsAdministrator
<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.122
Created on: 6/2/2016 10:14
Created by: Colin Squier <[email protected]>
Filename: Enable-LocalStoreOverride.ps1
===========================================================================
.DESCRIPTION
Enables local GPO store override, creates the key if it does not exist.
#>
[CmdletBinding()]
Param ()
if (Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Group Policy")
{
Write-Verbose -Message "Registry path exists, checking if the override is enabled."
$GPO = Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Group Policy" -Name EnableLocalStoreOverride
If ($GPO.EnableLocalStoreOverride -eq 0)
{
Write-Verbose -Message "Enabling local GPO store override."
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Group Policy" -Name EnableLocalStoreOverride -Value 1 | Out-Null
}
}
else
{
Write-Verbose -Message "Creating registry path."
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Group Policy" | Out-Null
Write-Verbose -Message "Creating registry key."
New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Group Policy" -Name EnableLocalStoreOverride -Type DWORD -Value 1 | Out-Null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment