How To Uninstall .NET SDK Previews And Older Versions When ...

I found a GitHub Issue from which I have made a Gist which lists all installed software, including any that is not visible.

Examples

Get ALL software containing (case-SENSITIVE) .NET Get-Installed -Name .NET

Get ALL software containing (case-SENSITIVE) .NET AND 3.1.10 Get-Installed -Name .NET | Where-Object {$_.DisplayName.Contains("3.1.10")}

Get ALL software containing (case-SENSITIVE) .NET AND 3.1.10 AND Remove that software Get-Installed -Name .NET | Where-Object {$_.DisplayName.Contains("3.1.10")} | Select -Expand PsChildName | Remove-Installed

function Get-Installed { [CmdletBinding()] param ( # The name of the software [Parameter(Mandatory = $true)] [string] $Name ) begin { $PATHS = @( "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall", "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" ) } process { $installed = $null ForEach ($path in $PATHS) { $installed += Get-ChildItem -Path $path | ForEach-Object { Get-ItemProperty $_.PSPath } | Where-Object { $null -ne $_.DisplayName -and $_.DisplayName.Contains($Name) } | Select-Object DisplayName, DisplayVersion, PSChildName | Sort-Object -Property DisplayName } $installed } end { } } function Remove-Installed { [CmdletBinding()] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true)] $Guid ) process { Write-Verbose "Removing $Guid" $a = "/x " + $Guid Start-Process msiexec -Wait -ArgumentList $a } } # Examples # # Get ALL software containing (case-SENSITIVE) .NET # Get-Installed -Name .NET # # Get ALL software containing (case-SENSITIVE) .NET AND 3.1.10 # Get-Installed -Name .NET | Where-Object {$_.DisplayName.Contains("3.1.10")} # # Get ALL software containing (case-SENSITIVE) .NET AND 3.1.10 AND Remove those software # Get-Installed -Name .NET | Where-Object {$_.DisplayName.Contains("3.1.10")} | Select -Expand PsChildName | Remove-Installed #

Từ khóa » Gỡ Bỏ Sdk