2

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

DaveC
  • 76
  • 1
  • 11

1 Answers1

3

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)

Syberdoor
  • 2,521
  • 1
  • 11
  • 14
  • When executing "C:\Program Files\Microsoft VS Code\unins000.exe" /SILENT, I get the error "Unable to execute file in the temporary directory. Setup aborted. Error 5: Access is denied." Is there anyway to tell what temp directory is being used? I am running this command from an elevated PowerShell CLI. – DaveC Oct 10 '18 at 12:47
  • does it work without silent for you? and does it work from "Add/remove software" (or whatever that is called in your os) for you? IS the same string present under HKLM\...\Uninstall ? (best to just go to root and search vor visual studio code from there). – Syberdoor Oct 10 '18 at 13:20
  • The temp used should be the user temp where a file like _iu14D2N.tmp is created (probably random). You can see this if you do not use /silent and watch in process explorer which childs are created – Syberdoor Oct 10 '18 at 13:27
  • I get the same error whether I leave out the /silent flag or when uninstalling via Apps & Features. It is trying to execute from the users appdata\local\temp directory, which is blocked from allowing anything to execute by our security policies. Thank you for your answer above, that was what I was looking for. – DaveC Oct 10 '18 at 16:18
  • Ah ok that explains it. However it should not be a problem once you use an sccm package for it because that will be the system account and thus the machine temp and not the user temp (and I think this is also used to install so you should be fine) – Syberdoor Oct 10 '18 at 17:28
  • When the uninstall is executed with the System account, it is able to complete the uninstall without error. – DaveC Oct 14 '19 at 15:42