Sep 25 2022 01:55 PM
Hi community!
I've just integrated Visual Studio Code user setup, due to the auto upgrade feature. The Install is fine but the Uninstall is not. Admin center status is Uninstall Failed The system cannot find the file specified. (0x80070002) See the install/uninstall commands below. I've also tested with "%LocalAppData%\Programs\Microsoft VS Code\unins000.exe" /SILENT /NOCANCEL
Anyone encountered a similar problem and found a solution?
Install command: VSCodeUserSetup-x64-1.65.2.exe /SILENT /NOCANCEL /MERGETASKS=!runcode
Uninstall command: "C:\Users\%UserName%\AppData\Local\Programs\Microsoft VS Code\unins000.exe" /SILENT /NOCANCEL
Install behavior: User
Sep 26 2022 04:26 AM
Sep 26 2022 05:19 AM
@Rudy_Ooms_MVP Thanks for your input Rudy! Do you use Intune yourself? If you want to be able to uninstall with a script, do you have to copy it into the file system in connection with the installation or is it included in the .intunewin package? It sounds complicated but I can try. The funny thing is, if I run "%LocalAppData%\Programs\Microsoft VS Code\unins000.exe" /SILENT /NOCANCEL manually, there is no problem.
Sep 26 2022 05:23 AM
Sep 26 2022 10:51 AM
@Rudy_Ooms_MVP I tried to uninstall with your PS-script via Intune and got a new error Uninstall Failed:
0x80070001 and VS Code remains installed. If I run the script manually, as admin, it works.
Sep 27 2022 08:23 AM
Oct 13 2022 02:31 AM
@Rudy_Ooms_MVP Thanks Rudy! This code will work if I run it manually as local admin. I will test it in Intune and get back.
ps Code -EA Ignore | kill -Force
Start-Sleep 10
$Exist = Get-ChildItem 'C:\Users\*\AppData\Local\Programs\Microsoft VS Code\unins000.exe'
$Path = $Exist.FullName
$Args = '/SILENT /NORESTART /FORCECLOSEAPPLICATIONS /log="C:\ProgramData\VSCodeUninstall.log"'
Start-Process $Path -Args $Args -Wait
Oct 13 2022 02:33 AM
Oct 17 2022 07:21 AM
Solution@Rudy_Ooms_MVP I saved my script as Uninstall.ps1 and added it to my VSCodeUserSetup-x64-1.65.2.intunewin file and uploaded it. I then changed the Uninstall command to PowerShell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File Uninstall.ps1. It doesn’t work on my own machine, but on three others. So that’s fine, probably something weird with my computer.
Thank you very much Rudy for your help! :grinning_face:
Oct 17 2022 07:23 AM