Hi @Esther Barhalibirhu ,
You can create a PowerShell script to detect and uninstall .NET versions across multiple machines. If you have access to each machine remotely, you can run the script on all of them.
# List of remote machines
$machines = @("Machine1", "Machine2", "Machine3")
# Loop through each machine
foreach ($machine in $machines) {
Invoke-Command -ComputerName $machine -ScriptBlock {
# Get a list of all .NET SDKs installed
$dotnetSDKs = Get-ChildItem -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" |
Where-Object { $_.GetValue("DisplayName") -match "Microsoft .NET SDK" }
# Uninstall each SDK found
foreach ($sdk in $dotnetSDKs) {
$uninstallString = $sdk.GetValue("UninstallString")
if ($uninstallString) {
# Run the uninstallation command
Start-Process -FilePath $uninstallString -ArgumentList "/quiet" -NoNewWindow -Wait
}
}
}
}
Best Regards.
Jiachen Li
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.