Created
June 2, 2016 16:26
-
-
Save Hexalon/5497a5fd8e8098dff112f240aa35c1ba to your computer and use it in GitHub Desktop.
Disables local GPO store override, creates the key if it does not exist.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires -RunAsAdministrator | |
<# | |
.NOTES | |
=========================================================================== | |
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.122 | |
Created on: 6/2/2016 11:24 | |
Created by: Colin Squier <[email protected]> | |
Filename: Disable-LocalStoreOverride.ps1 | |
=========================================================================== | |
.DESCRIPTION | |
Disables 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 1) | |
{ | |
Write-Verbose -Message "Disabling local GPO store override." | |
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Group Policy" -Name EnableLocalStoreOverride -Value 0 | 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 0 | Out-Null | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment