visual-studio-codeuninstallationsccm

How to uninstall VS Code from cli on Windows


I am trying to create a SCCM package for installing/uninstalling VS Code on Windows. I am able to install without any problems, but I cannot get it to uninstall.

Here is what I have tried:

For reference, VSCodeSetup-x64-1.28.0.exe is the executable I used for installing vs code.

From Powershell: Start-Process -FilePath .\VSCodeSetup-x64-1.28.0.exe -ArgumentList "/uninstall" -Wait -PassThru (This just executes the installer with no options to uninstall)

Start-Process -FilePath "C:\Program Files\Microso ft VS Code\Code.exe" -ArgumentList "/uninstall" -Wait -PassThru (This just opens VS Code)

I looked at the following site for command line options, but no mention of uninstall. http://jrsoftware.org/ishelp/index.php?topic=setupcmdline


Solution

  • Looking at the uninstall string in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ (For me it was {F8A2A208-72B3-4D61-95FC-8A65D340689B}_is1 but this could be version dependent) it seems like there is a REG_SZ QuietUninstallString which in my case pointed to:

    "C:\Program Files\Microsoft VS Code\unins000.exe" /SILENT
    

    So you could either if those are all default instalations just hard code that path (relative to where you installed it so possibly program files (x86) or some other path) or read the string before uninstall in some script and use it directly (might also be affected by WoW64 I only did a quick test on a 32bit system)