Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue: GSudo Failing in MSStore PWSH (Failed to load hostfxr.dll) #106

Closed
resech opened this issue Sep 7, 2021 · 2 comments
Closed

Issue: GSudo Failing in MSStore PWSH (Failed to load hostfxr.dll) #106

resech opened this issue Sep 7, 2021 · 2 comments

Comments

@resech
Copy link

resech commented Sep 7, 2021

Issue Description

I'm unable to elevate within pwsh, though using gsudo in a cmd window works as expected. This appears to be similar to #65

Screenshots

image

C:\Users\rsechler>pwsh -nop
PowerShell 7.1.4
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

PS C:\Users\rsechler> $PSVersionTable.OS
Microsoft Windows 10.0.19043
PS C:\Users\rsechler> gsudo --debug
Debug: Applying workaround for target app installed via MSStore.
Debug: Command to run: C:\Windows\system32\cmd.exe /s /c ""C:\Program Files\WindowsApps\Microsoft.PowerShell_7.1.4.0_x64__8wekyb3d8bbwe\pwsh.exe" -NoLogo"
Debug: Using Console mode TokenSwitch
Debug: CreateProcessAsUser: C:\Windows\system32\cmd.exe /s /c ""C:\Program Files\WindowsApps\Microsoft.PowerShell_7.1.4.0_x64__8wekyb3d8bbwe\pwsh.exe" -NoLogo"
Debug: Elevating process: C:\ProgramData\chocolatey\lib\gsudo\bin\gsudo.exe --debug gsudoelevate --pid 3968
Debug: Elevated instance started.
Failed to load the dll from [C:\Program Files\WindowsApps\Microsoft.PowerShell_7.1.4.0_x64__8wekyb3d8bbwe\hostfxr.dll], HRESULT: 0x80070005
The library hostfxr.dll was found, but loading it from C:\Program Files\WindowsApps\Microsoft.PowerShell_7.1.4.0_x64__8wekyb3d8bbwe\hostfxr.dll failed
  - Installing .NET prerequisites might help resolve this problem.
     https://go.microsoft.com/fwlink/?linkid=798306
Debug: Process exited with code -2147450750
PS C:\Users\rsechler> gsudo --version
gsudo v1.0.2 (Branch.master.Sha.cab27ed3ca23496129320dfed56624274c9a27a6)
Copyright(c) 2019-2021 Gerardo Grignoli and GitHub contributors

Windows version:
image

@gerardog
Copy link
Owner

gerardog commented Sep 7, 2021

Hi,

  • Is your user a local admin or are you typing user & password at the UAC prompt?
  • Can you try: 'gsudo -d cmd' to elevate cmd first, then call "C:\Program Files\WindowsApps\Microsoft.PowerShell_7.1.4.0_x64__8wekyb3d8bbwe\pwsh.exe"?
  • Also, open cmd as admin (without gsudo) then run "C:\Program Files\WindowsApps\Microsoft.PowerShell_7.1.4.0_x64__8wekyb3d8bbwe\pwsh.exe"

Thanks.

@resech
Copy link
Author

resech commented Sep 7, 2021

I am a local admin, just get the Yes/No UAC screen.

I ran through both the methods you've mentioned, I'm getting the same error on both:

Failed to load the dll from [C:\Program Files\WindowsApps\Microsoft.PowerShell_7.1.4.0_x64__8wekyb3d8bbwe\hostfxr.dll], HRESULT: 0x80070005
The library hostfxr.dll was found, but loading it from C:\Program Files\WindowsApps\Microsoft.PowerShell_7.1.4.0_x64__8wekyb3d8bbwe\hostfxr.dll failed
  - Installing .NET prerequisites might help resolve this problem.
     https://go.microsoft.com/fwlink/?linkid=798306

Based on that, it looks like this is an issue with my install especially since the second method doesn't use gsudo. I'll see if I can get that sorted, thank you for the testing steps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants