Get-AppxPackage Throws Error
Posted: Mon Sep 16, 2024 9:06 am
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
>> 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.
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
- Get-AppxPackage -AllUsers | Sort-Object -Unique | Select-Object Name
>> 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.