Set-GphGpDebugLogging.ps1
function Set-GphGpDebugLogging { <# .SYNOPSIS Enables enhanced GPO Logging for the Client. .DESCRIPTION To Default Logging for Group Policies writes to the Windows Event Log. For a deeper insight into the working of the Group Policy Client, enhanced GPO Logging can be activated. The Log is written to %windir%\debug. .EXAMPLE Set-GPDebugLogging Enables Debug Logging (Sets the according Registry-Key) .EXAMPLE Set-GPDebugLogging -disable Disables Debug Logging (Sets the according Registry-Key) #> [CmdletBinding()] param( # To disable Debug-Logging, enabled this Parameter [switch] $disable ) $diagnosticsPath = 'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Diagnostics' If (-not ( Test-Path -Path Registry::$diagnosticsPath)) { New-Item -Path Registry::$diagnosticsPath New-ItemProperty -Path Registry::$diagnosticsPath -Name GPSvcDebugLevel -Value '0x30002' -PropertyType DWord } New-Item -Path $env:windir\debug\Usermode\ -ItemType Directory } |