Microsoft.WinGet.Client- Get-WinGetPackage : This cmdlet is not supported in Windows PowerShell in Systemcontext
Brief description of your issue
After installing the current version (1.9.2411) of the Microsoft.WinGet.Client package from PSGallery many of the commands throw following errors:
Get-WinGetPackage : This cmdlet is not supported in Windows PowerShell.
Find-WinGetPackage : This cmdlet is not supported in Windows PowerShell.
get-WinGetPackage : This cmdlet is not supported in Windows PowerShell.
Install-WinGetPackage : This cmdlet is not supported in Windows PowerShell.
Psversion in System context: `$PSVersionTable
Name Value
PSVersion 5.1.22621.4111 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.22621.4111 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1`
Steps to reproduce
Open PS in System Context
Install-Module Microsoft.WinGet.Client -Repository PSGallery -Scope AllUsers -Force
Import-Module Microsoft.WinGet.Client
Find-WinGetPackage HeidiSQL.HeidiSQL
Expected behavior
`Find-WinGetPackage HeidiSQL.HeidiSQL
Name Id Version Source
HeidiSQL HeidiSQL.HeidiSQL 12.8 winget`
Actual behavior
Get-WinGetPackage : This cmdlet is not supported in Windows PowerShell.
Find-WinGetPackage : This cmdlet is not supported in Windows PowerShell.
get-WinGetPackage : This cmdlet is not supported in Windows PowerShell.
Install-WinGetPackage : This cmdlet is not supported in Windows PowerShell.
Environment
Windows: Windows.Desktop v10.0.22631.4169
Systemarchitektur: X64
Paket: Microsoft.DesktopAppInstaller v1.23.1911.0
PSVersion 5.1.22621.4111
Microsoft.WinGet.Client 1.9.2411 from PSGallery
Windows 11 22631.4169
I'm not entirely sure, but I believe this might work on PowerShell, which despite the similar naming, has some differences from Windows Powershell. Would it be possible to install that CLI to test?
Hi,
In Powershell 7 everything works as expected. But as i understand, this module should be compatible with powershell 5.1 as stated in PSgallery. Since we want to use some of this Modules functionality in Intune/ConfigMgr, Powershell 7 is sadly out of the picture.
Thanks
Hey, im actually having similar problem. Using terminal and this path for powershell: C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe. Totaly works.
But if i run it using rust programming language and using the same path it gives this error: Get-WinGetPackage : This cmdlet is not supported in Windows PowerShell.
This issue occurs (at least for me) if I try to run this cmdlets with SYSTEM rights:
PS C:\WINDOWS\system32> Import-Module Microsoft.WinGet.Client
PS C:\WINDOWS\system32> Get-Module
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Binary 1.9.25190 Microsoft.WinGet.Client {Add-WinGetSource, Assert-WinGetPackageManager, Disable-Wi...
Script 2.0.0 PSReadLine {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PS...
PS C:\WINDOWS\system32> Get-WinGetpackage
Get-WinGetpackage : This cmdlet is not supported in Windows PowerShell.
In Zeile:1 Zeichen:1
+ Get-WinGetpackage
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-WinGetPackage], WindowsPowerShellNotSupported
+ FullyQualifiedErrorId : RuntimeException,Microsoft.WinGet.Client.Commands.GetPackageCmdlet
PS C:\WINDOWS\system32> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.26100.2161
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.26100.2161
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
can confirm. still an issue with v1.9.25190 in SYSTEM Context
PS C:\WINDOWS\system32> Find-WinGetPackage
Find-WinGetPackage : This cmdlet is not supported in Windows PowerShell.
In Zeile:1 Zeichen:1
+ Find-WinGetPackage
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Find-WinGetPackage], WindowsPowerShellNotSupported
+ FullyQualifiedErrorId : RuntimeException,Microsoft.WinGet.Client.Commands.FindPackageCmdlet
PS C:\WINDOWS\system32> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.26100.2161
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.26100.2161
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Seems related to a general winget issue -> https://github.com/microsoft/winget-cli/issues/3049 You can bypass this by using PowerShell 7.X. PowerShell 5.1 is still the standard and therefore it would be great, if this module could somehow fix this issue (if possible at all).
Hi, Is there any progess on the issue? Is the fact that using the powershell module commands in system context in PS 5.1 is not working a bug? Or is is simply not supported? If not, will it be supported in the future and when can we expect this support?
Hi,
are there any news regarding this issue?
Thanks!
Confirming still an issue as of 1.10.340.
for Packaging in Intune the requirement to have it work in SYSTEM-COntext is quite important. I second the Issue still exists
We need this feature in PowerShell v5 because Intune Detection Scripts run in SYSTEM if you need to install WinGet software using the cmdlets of the module
+1 I discovered this PowerShell module today, first thing I did with it was create an Intune Remediation script and Bam! straight away I hit this error. Was like Christmas came early then was snatched from my fingertips all in the same day. Thank you Winget team for all your effort so far, I can't wait until the PowerShell module works well in Intune.
https://powershellisfun.com/2025/05/16/deploy-and-automatically-update-winget-apps-in-intune-using-powershell-without-remediation-or-3rd-party-tools/?amp=1
This is how I got it working, calling PS7 from PS5 in MTA and installing it in SystemOrUnknown mode. Wrote this blog post and did a session about it, too