Skip to content

Commit

Permalink
Also checks if the provider is registered with Get-WinEvent before un…
Browse files Browse the repository at this point in the history
…registering
  • Loading branch information
virot committed Nov 13, 2024
1 parent 1118217 commit b8a4414
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions TameMyCerts/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ process {
}

# If EWT Logging manifest exist unregister that one.
If (Test-Path -Path "$BaseDirectory\$($PolicyModuleName).events.man") {
Write-Verbose "Found the required files for EWT logging, unregistering with wevtutil"
If (((Get-WinEvent -ListProvider $PolicyModuleName -ErrorAction SilentlyContinue) -ne $Null) -and (Test-Path -Path "$BaseDirectory\$($PolicyModuleName).events.man")) {
Write-Verbose "Found the required files for EWT logging, unregistering with wevtutil"
Start-Process `
-FilePath "$($env:SystemRoot)\System32\wevtutil.exe" `
-ArgumentList "um", """$BaseDirectory\$($PolicyModuleName).events.man""" `
Expand Down

0 comments on commit b8a4414

Please sign in to comment.