Issue uninstalling Visual Studio from cmd


I am trying to write an uninstall command for Visual Studio 2022 Pro for an Intune app but encountering issues with admin privileges: 5007 Operation was blocked – the computer does not meet the requirement.

Here is the command:

"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vs_installer.exe" uninstall --quiet --norestart --installPath "C:\Program Files\Microsoft Visual Studio\2022\Enterprise

The issue is –quiet and –norestart cannot be run without admin rights, but when I run this in an admin elevated cmd it still throws the error. I tried adding Start-Process, but that doesn’t work in cmd. Is this just something that cannot be done?

Leave a Reply

Your email address will not be published. Required fields are marked *