Skip to content

Instantly share code, notes, and snippets.

@jfrantz1-r7
Created August 24, 2018 01:52
Show Gist options
  • Save jfrantz1-r7/55046cd7bf421c4029afba3cc9ff6b17 to your computer and use it in GitHub Desktop.
Save jfrantz1-r7/55046cd7bf421c4029afba3cc9ff6b17 to your computer and use it in GitHub Desktop.
function Enable-ProtectedEventLogging
{
param(
[Parameter(Mandatory)]
$Certificate
)
$basePath = “HKLM:\Software\Policies\Microsoft\Windows\EventLog\ProtectedEventLogging”
if(-not (Test-Path $basePath))
{
$null = New-Item $basePath –Force
}
Set-ItemProperty $basePath -Name EnableProtectedEventLogging -Value “1”
Set-ItemProperty $basePath -Name EncryptionCertificate -Value $Certificate
}
function Disable-ProtectedEventLogging
{
Remove-Item HKLM:\Software\Policies\Microsoft\Windows\EventLog\ProtectedEventLogging -Force –Recurse
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment