Page 1 of 1

Get-AppxPackage Throws Error

Posted: Mon Sep 16, 2024 9:06 am
by gbmacman2
I cant say if this issue exists in all 24H2, but I patched my installed preview release this morning (KB5041571) and this doesn't work inside PS Studio. This command works perfectly in Terminal and PowerShell ISE. NOT related, but winget hangs on confirmation if never run before (also works in terminal or PS ISE).

Product: PowerShell Studio 2024 (64 Bit)
Build: v5.8.248
OS: Windows 11.0.26100.1457 (Release Preview 24H2 Enterprise)
PS Version(s): 5.1.26100.1, 7.4.5
  1. Get-AppxPackage -AllUsers | Sort-Object -Unique | Select-Object Name
>> Running (Untitled) Script Selection...
>> Platform: V5 64Bit (STA) (Elevated)
ERROR: Get-AppxPackage : The type initializer for '<Module>' threw an exception.
ERROR: At Line: 15 char: 1
ERROR: + Get-AppxPackage -AllUsers | Sort-Object -Unique | Select-Object Name
ERROR: + ~~~~~~~~~~~~~~~
ERROR: + CategoryInfo : NotSpecified: (:) [], TypeInitializationException
ERROR: + FullyQualifiedErrorId : System.TypeInitializationException
ERROR:

*** PowerShell Script finished. ***
>> Execution time: 00:00:02
>> Script Ended
>> Copied to clipboard.

Re: Get-AppxPackage Throws Error

Posted: Mon Sep 16, 2024 3:02 pm
by brittneyr
Preview versions of Windows are not supported and therefore are not tested with our products. Only official Windows releases are subject to support.

The error message is from the command, not PowerShell Studio. We do not have any control over WinGet.