vswhere
vswhere copied to clipboard
One of my office PC fails to find MSVC when not running in elevated terminal.
I have tried reinstall MSVC 2019/2022, but it doesn't work. I have to always run vscode/vs installer as administrator in order to use MSVC. My user account is already in administrators group. Could it be some components owned by some administrator and not readable by others?
What command are you running? What channel did you install? Note that prereleases and incomplete installs are not shown by default. Running vswhere -help will give you more details.
Hi @heaths
I have tested with latest version of vswhere.
I'm not using prereleases or buildtools.
If the same command works as administrator, it seems you have an atypical permissions issue on %ProgramData%. Install Process Monitor, run that to collect a trace, filter by the process name vswhere, export only the unfiltered results, zip, and attach them here.
Alternative, though it may not be as helpful, run the following in an elevated command prompt:
cmd
icacls "%ProgramData%\Microsoft\VisualStudio\Packages\_Instances"
or
powershell
icacls "${env:ProgramData}\Microsoft\VisualStudio\Packages\_Instances"
/cc @tydunkel
I ran the powershell but problem still exists. Here's the problem trace: Logfile.zip
Thanks. As I suspected, you're getting an ERROR_ACCESS_DENIED trying to read/list the directory above. icacls should've produced output if you run it elevated, which will help diagnose the problem and suggest a fix. Please paste it in a reply.
Normally, %ProgramData% has read/list (RX) permissions for Everyone, but it seems that's not the case for you or that it has an integrity level higher than normal - allowing only elevated access. icacls will show us that.
Thank you for the information, I managed to recover the permission of the mentioned folder.
The original output of the command is
pika1 icacls "${env:ProgramData}\Microsoft\VisualStudio\Packages\_Instances"
C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances BUILTIN\Administrators:(F)
BUILTIN\Administrators:(I)(OI)(IO)(F)
BUILTIN\Administrators:(I)(CI)(F)
And I replaced all child object permission entries of ${env:ProgramData}\Microsoft\VisualStudio
And it became
pika1 icacls "${env:ProgramData}\Microsoft\VisualStudio\Packages\_Instances"
C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances Everyone:(I)(OI)(CI)(M)
BUILTIN\Users:(I)(OI)(CI)(M)
NT AUTHORITY\SYSTEM:(I)(OI)(CI)(F)
BUILTIN\Administrators:(I)(OI)(CI)(F)
Successfully processed 1 files; Failed processing 0 files
And I can access MSVC without administrator privileges!
Here's a question: Is it possible to show some error messages about why it can't find usable MSVC? In this case, yelling permission error on the folder maybe helpful.