-
Notifications
You must be signed in to change notification settings - Fork 6
/
UninstallFilter.ps1
38 lines (31 loc) · 980 Bytes
/
UninstallFilter.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function Test-RegistryValue {
param(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
$Path,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
$Key
)
try {
Get-ItemProperty -Path $Path | Select-Object -ExpandProperty $Key -ErrorAction Stop | Out-Null
return $true
} catch {
return $false
}
}
$path = "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa"
$name = "Notification Packages"
$filt = "ipf"
Set-Content -Path "C:\improsec-filter\weak-enabled.txt" -Value "0" -Force | Out-Null
Set-Content -Path "C:\improsec-filter\leaked-enabled.txt" -Value "0" -Force | Out-Null
if (Test-RegistryValue -Path $path -Key $name) {
$oldval = @((Get-ItemPropertyValue -Path $path -Name $name))
$newval = @()
foreach ($v in $oldval) {
if ($v -ne $filt) {
$newval += $v
}
}
Set-ItemProperty -Path $path -Name $name -Value $newval
}