Skip to content

Instantly share code, notes, and snippets.

@shanselman
Created March 3, 2018 01:33
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shanselman/00f156515a774943b1bb86c100db9eda to your computer and use it in GitHub Desktop.
Save shanselman/00f156515a774943b1bb86c100db9eda to your computer and use it in GitHub Desktop.
Remove .NET Core ASK Previews - Run as admin
$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