Commit ae7e50b 1 parent 7d36f50 commit ae7e50b Copy full SHA for ae7e50b
File tree 1 file changed +10
-6
lines changed
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -28,16 +28,20 @@ function Remove-RegistryEntries {
28
28
$versionFilter = Get-RegistryVersionFilter - Architecture $Architecture - MajorVersion $MajorVersion - MinorVersion $MinorVersion
29
29
30
30
$regPath = " HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products"
31
- $regKeys = Get-ChildItem - Path Registry::$regPath - Recurse | Where-Object Property -Ccontains DisplayName
32
- foreach ($key in $regKeys ) {
33
- if ($key.getValue (" DisplayName" ) -match $versionFilter ) {
34
- Remove-Item - Path $key.PSParentPath - Recurse - Force - Verbose
31
+ if (Test-Path - Path Registry::$regPath ) {
32
+ $regKeys = Get-ChildItem - Path Registry::$regPath - Recurse | Where-Object Property -Ccontains DisplayName
33
+ foreach ($key in $regKeys ) {
34
+ if ($key.getValue (" DisplayName" ) -match $versionFilter ) {
35
+ Remove-Item - Path $key.PSParentPath - Recurse - Force - Verbose
36
+ }
35
37
}
36
38
}
37
39
38
40
$regPath = " HKEY_CLASSES_ROOT\Installer\Products"
39
- Get-ChildItem - Path Registry::$regPath | Where-Object { $_.GetValue (" ProductName" ) -match $versionFilter } | ForEach-Object {
40
- Remove-Item Registry::$_ - Recurse - Force - Verbose
41
+ if (Test-Path - Path Registry::$regPath ) {
42
+ Get-ChildItem - Path Registry::$regPath | Where-Object { $_.GetValue (" ProductName" ) -match $versionFilter } | ForEach-Object {
43
+ Remove-Item Registry::$_ - Recurse - Force - Verbose
44
+ }
41
45
}
42
46
43
47
$uninstallRegistrySections = @ (
You can’t perform that action at this time.
0 commit comments