Closed agabrys closed 11 months ago
It is currently working as expected, though I am not entirely sure why. It was functioning correctly, then I encountered this strange issue, and now it is working again. I shut down my computer every day, so perhaps that action resolved the problem.
Thank you for the update @agabrys. I have briefly looked through the logs, and I too am at a loss for what could have caused it (other than maybe you thought you were elevated but weren't actually, but that feels really odd for seeing it in multiple shells).
Should it happen again, one troubleshooting step might be to check the tokens to determine if you're administrator. You can do that with this snippet from Sean Wheeler's profile:
$identity = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = [Security.Principal.WindowsPrincipal] $identity
$principal.IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')
Checklist
What You Are Seeing?
I encountered a very strange issue. When I run PowerShell 5 (default version on Windows) or Command Prompt as administrator, chocolatey says I did not run them as admin. When I do the same in PowerShell 7, everything works as it should.
PowerShell 5.X
Command Prompt
PowerShell 7.X
What is Expected?
Every shell run as administrator should be detected as an elevated command shell by chocolatey.
How Did You Get This To Happen?
Prerequsites:
Steps:
it fails with a message
it fails with a message
it works
System Details
Installed Packages
Output Log
PowerShell 5.X: https://gist.github.com/agabrys/f01bfd8b3a3d3ba0c10ef4fc87b014e3
PowerShell 7.X: https://gist.github.com/agabrys/38ebfa3065a275fa9d7adfc9438e67e6
Additional Context
I reinstalled chocolatey and it did not help. I have a feeling that PowerShell 7.X blocked some files.