Created
March 3, 2018 01:33
-
-
Save shanselman/00f156515a774943b1bb86c100db9eda to your computer and use it in GitHub Desktop.
Remove .NET Core ASK Previews - Run as admin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$choices = New-Object Collections.ObjectModel.Collection[Management.Automation.Host.ChoiceDescription] | |
$choices.Add((New-Object Management.Automation.Host.ChoiceDescription -ArgumentList '&Yes')) | |
$choices.Add((New-Object Management.Automation.Host.ChoiceDescription -ArgumentList '&No')) | |
Get-WmiObject Win32_Product -filter "name LIKE '%Preview%' AND name LIKE '%SDK%'" | ForEach-Object { | |
$message = "ZOMG" | |
$question = "Uninstall " + $_.Name + "?" | |
$decision = $Host.UI.PromptForChoice($message, $question, $choices, 0) | |
if($decision -eq 0) { | |
$_.Uninstall() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment