Remove unwanted Windows applications

Remove unwanted Windows applications

This script uses the Microsoft.Win32.RegistryKey class to list all installed programs and their details. The user is then prompted to enter the name o

Remove Windows Bloatware
Enable Windows GOD Mode
Disable SSL 2.0/3.0 and TLS 1.0/1.1

This script uses the Microsoft.Win32.RegistryKey class to list all installed programs and their details. The user is then prompted to enter the name of the program(s) they want to uninstall. The script then uninstalls the selected program(s) one by one.

Please note that this script requires administrative privileges to run.

$UninstallKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
$reg = [Microsoft.Win32.RegistryKey]::OpenBaseKey('LocalMachine', 'Registry64')
$regkey = $reg.OpenSubKey($UninstallKey)
$subkeys = $regkey.GetSubKeyNames()

Write-Host "Installed programs:"
$programs = @()
foreach ($key in $subkeys) {
    $thisKey = $UninstallKey + "\\" + $key
    $thisSubKey = $reg.OpenSubKey($thisKey)
    $program = New-Object PSObject
    $program | Add-Member -MemberType NoteProperty -Name "DisplayName" -Value $thisSubKey.GetValue("DisplayName")
    $program | Add-Member -MemberType NoteProperty -Name "DisplayVersion" -Value $thisSubKey.GetValue("DisplayVersion")
    $program | Add-Member -MemberType NoteProperty -Name "Publisher" -Value $thisSubKey.GetValue("Publisher")
    $program | Add-Member -MemberType NoteProperty -Name "InstallLocation" -Value $thisSubKey.GetValue("InstallLocation")
    $programs += $program
}

$programs | Format-Table -AutoSize

$Selection = Read-Host "Enter the name of the program you want to uninstall:"
$ProgramsToRemove = $programs | Where-Object { $_.DisplayName -like "*$Selection*" }

if ($ProgramsToRemove) {
    Write-Host "Selected programs to remove:"
    $ProgramsToRemove | Format-Table -AutoSize
    $Confirm = Read-Host "Are you sure you want to remove these programs? (y/n)"
    if ($Confirm -eq "y") {
        foreach ($program in $ProgramsToRemove) {
            $UninstallString = $reg.OpenSubKey($UninstallKey + "\\" + $subkeys[$programs.IndexOf($program)]).GetValue("UninstallString")
            if ($UninstallString) {
                Write-Host "Uninstalling $($program.DisplayName)..."
                Start-Process cmd -ArgumentList "/c $UninstallString /quiet /norestart" -Wait
            }
        }
    }
    else {
        Write-Host "Aborting..."
    }
}
else {
    Write-Host "No programs found with name '$Selection'."
}

 

COMMENTS

WORDPRESS: 0