[Initial]
Message=Deinstalliere MDG Visual Studio Code...
DefVar $ExitCode$

[Aktionen]
ShowBitmap "%ScriptPath%\logo.png" "MDG Visual Studio Code"
Sub_PrepareRemove
WinBatch_Setup
Sub_HandleExitCode

[Sub_PrepareRemove]
if (processIsRunning("Code.exe"))
  comment "Killing Process..."
  Killtask "Code.exe"
  sleepSeconds 3
endif

[WinBatch_Setup]
"%ProgramFiles64Dir%\Microsoft VS Code\unins000.exe" /VERYSILENT /SUPPRESSMSGBOXES /LOG="%opsiLogDir%\vscode-uninstall.log"

; VERYSILENT unterdrückt das Installationsfenster
; SUPPRESSMSGBOXES unterdrückt Benachrichtigungsfenster

[Sub_HandleExitCode]
; check return code
Set $ExitCode$ = GetLastExitCode
comment "GetLastExitCode: " + $ExitCode$
if not($ExitCode$ = "0")
  LogError "Fatal: setup returned exit code " + $ExitCode$
  IsFatalError
endif
