forked from PckgrBot/Pckgr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFixgrepWinSystemInstall
30 lines (24 loc) · 1.24 KB
/
FixgrepWinSystemInstall
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
# Define the registry path and values
$registryPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
$displayName = "grepWin x64"
$installLocation = "C:\Windows\system32\config\systemprofile\AppData\Local\Programs\grepWin\"
# Check if the registry key exists
if (Test-Path -Path $registryPath) {
# Get the subkeys
$subKeys = Get-ChildItem -Path $registryPath
foreach ($subKey in $subKeys) {
$subKeyPath = $registryPath + $subKey.PSChildName
# Get the DisplayName and InstallLocation values
$currentDisplayName = Get-ItemProperty -Path $subKeyPath -Name "DisplayName" -ErrorAction SilentlyContinue
$currentInstallLocation = Get-ItemProperty -Path $subKeyPath -Name "InstallLocation" -ErrorAction SilentlyContinue
if ($currentDisplayName.DisplayName -eq $displayName -and $currentInstallLocation.InstallLocation -eq $installLocation) {
# Delete the registry key
Remove-Item -Path $subKeyPath -Recurse -Force
# Remove the install location
Remove-Item -Path $installLocation -Recurse -Force
Write-Output "The registry key and install location have been deleted."
}
}
} else {
Write-Output "The registry path does not exist."
}