我在使用poweshell7无法使用Get-AppXPackage命令

Lei 0 信誉分
2024-05-13T10:39:34.7533333+00:00

是这样的,我记得我之前可以使用powershell7使用Appx命令,但是现在不可以了。我之前在卸载windows内置应用时,用geek发现有两个一摸一样的APP Install的应用程序,他们地安装文件夹包括名字全都一摸一样,所以我卸载了其中一个,结果两个都没了;由于是Microsoft Store的应用,所以我打算在Store中找到在下载一下,可是没有收到但是没有影响到我的正常使用,所以就没在意。

可是我在用Powershell7使用Appx命令时报错

Get-AppXPackage: The 'Get-AppXPackage' command was found in the module 'Appx', but the module could not be loaded due to the following error: [Operation is not supported on this platform. (0x80131539)]

For more information, run 'Import-Module Appx'.

想到可能是之前卸载的APP Install问题,但是我在powershell1.0却可以使用,所以我想问一下相关技术人员,并想办法安装会APP Install这个应用,以免造成之后系统的故障。

Windows 10
Windows 10
在个人计算机和平板电脑上运行的 Microsoft 操作系统。
63 个问题
0 个注释 无注释
{count} 票

2 个答案

排序依据: 非常有帮助
  1. Lei 0 信誉分
    2024-05-13T10:45:53.43+00:00

    Import-Module: Operation is not supported on this platform. (0x80131539)

    我感觉我好像删除了核心模块,现在连Import-Module都不行了。

    Get-Module -ListAvailable -All Appx

    输出

    Directory: C:\Windows\system32\WindowsPowerShell\v1.0\Modules
    

    ModuleType Version PreRelease Name PSEdition ExportedCommands


    Manifest 2.0.1.0 Appx Core,Desk {Add-AppxPackage, Get-AppxPackage, Get-…

    Script 0.0 Appx Desk {Get-AppxLog, Get-AppxLastError}


  2. Ian Xue (Shanghai Wicresoft Co., Ltd.) 31,091 信誉分 Microsoft 供应商
    2024-05-14T03:41:35.2933333+00:00

    您好,

    欢迎在Q&A论坛发帖。

    我查了一下,看到有人提到在Windows 10上PowerShell从7.1版本就开始存在这个问题了。

    https://github.com/PowerShell/PowerShell/issues/13138

    我在Windows 10环境里试了一下,PowerShell 7.0是可以正常加载Appx模块的,但是从7.1到最新的7.4都存在同样的问题。

    要在Windows 10使用Appx模块,只能是在PowerShell 7中Import-Module加载模块时使用-UseWindowsPowerShell启用Windows PowerShell兼容性功能,或者直接使用Windows 10自带的Windows PowerShell 5.1。

    祝好

    Ian Xue


    如果回复有帮助,请帮忙点击 "接受答案"。

    0 个注释 无注释