jdhitsolutions / WingetTools

A set of PowerShell tools for working with the winget package manager.
MIT License
146 stars 14 forks source link

[Bug]: Running Get-WGPath delivers wrong path in System Context #14

Open AbsoluteBlack0 opened 1 year ago

AbsoluteBlack0 commented 1 year ago

Describe the problem

I am running a system context Powershell session. Get-WingetPath delivers the wrong winget.exe location because it expects nt-authority. Culture is german, so the system answers with nt-autorität as result of whoami.

Log is in additional informations.

Expectation

No response

Additional Information

PS C:\Windows\system32> Get-WGPath AUSFÜHRLICH: [14:10:07.3657127] Starting Get-WGPath AUSFÜHRLICH: [14:10:07.3827148] Running as nt-autorität\system AUSFÜHRLICH: [14:10:07.3837279] Using user default location C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps\Winget.exe AUSFÜHRLICH: [14:10:07.3867134] Ending Get-WGPath

PowerShell version

5.1

Platform

Windows 10 Pro or Enterprise

Additional Checks

jdhitsolutions commented 1 year ago

This is part of an ongoing issue dealing with non-English output. I'll add this to the list.

jdhitsolutions commented 1 year ago

What technique or process are you using to run as system?

AbsoluteBlack0 commented 1 year ago

I am trying to write a proactive remediation script for intune which installs / uninstalls / updates a custom list of apps. At this point I am trying to run it in system context.

For testing purposes PSTools: PsExec.exe -s -i cmd.exe

I was trying to run plain winget in those scripts but as of now I could not find out why my winget list and winget upgrade calls did not deliver output.

It is more like a experimental learning process if I can use winget this way or if I need to stick to traditional Win32 deployment.

jdhitsolutions commented 1 year ago

That's the technique I use as well. The issue is the German culture and parsing that text.

fredrikhenne commented 9 months ago

Sent a pull request with the changes that I'm using locally for swedish locale in which we match on SID instead of accountnames. #23