Skip to content

Instantly share code, notes, and snippets.

@timsneath
Created October 10, 2016 23:12
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timsneath/9f9e384ef7b986fbcd873e75e4cae7c4 to your computer and use it in GitHub Desktop.
Save timsneath/9f9e384ef7b986fbcd873e75e4cae7c4 to your computer and use it in GitHub Desktop.
# Setup assets
$foldersToDelete = ,"$env:ProgramData\Microsoft\VisualStudio\Packages"
$foldersToDelete += "$env:AppData\Microsoft\VisualStudio\Packages"
$foldersToDelete |? { Test-Path $_ } |% { del -rec -for $_ }
# VS assets
# Any VS installation folders
if (test-path $env:ProgramData\Microsoft\VisualStudio\Packages\_Instances) {
gci $env:ProgramData\Microsoft\VisualStudio\Packages\_Instances -filter state.json -recurse | gc -raw | convertfrom-json | select -expand installationPath | del -force -recurse
}
if (test-path "${env:ProgramFiles(x86)}\Microsoft Visual Studio") {
del -rec -for "${env:ProgramFiles(x86)}\Microsoft Visual Studio"
}
del -rec -for $env:localappdata\Microsoft\VisualStudio\15.0*,$env:AppData\Microsoft\VisualStudio\15.0*
reg query HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\ | findstr 15.0 |% { reg delete $_ /f }
reg query HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft | findstr VisualStudio_ |% { reg delete $_ /f }
Reg query HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio | findstr 15.0 |% { reg delete $_ /f }
# Remove all VS singletons
# get-package vs_* | uninstall-package
get-package -provider msi | where { $_.name -like "vs_*" } | uninstall-package -additionalArguments "IGNOREDEPENDENCIES=ALL"
@timsneath
Copy link
Author

This script cleans up all remnants of Visual Studio "15" Preview 4. Use this prior to installing Preview 5 if you're experiencing problems with installation.

@seanvree
Copy link

seanvree commented Apr 7, 2017

wow, this is good.

So I HAVE VS17 installed, but a few components didn't install because of a corrupt VS16 install.

So, since I already have VS17 installed, do you recommend uninstalling VS17, running this script, then reinstalling VS17?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment