Powershell Get-AppxPackage 不起作用

Ste*_*etz 6 services powershell

这是错误:Get-AppxPackage -AllUsers

Get-AppxPackage : The service cannot be started, either because it is disabled or because it has no enabled devices
associated with it.
The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.
At line:1 char:1
+ Get-AppxPackage
+ ~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-AppxPackage], Exception
    + FullyQualifiedErrorId : System.Exception,Microsoft.Windows.Appx.PackageManager.Commands.GetAppxPackageCommand
Run Code Online (Sandbox Code Playgroud)

通过 services.msc 禁用的服务是什么?它是哪一项?

Ste*_*etz 8

另一个答案指出的问题是因为 AppX 部署服务被禁用。以下是启用它的方法:

  1. 按Win + R
  2. 写入注册表
  3. 按回车键
  4. 转到计算机\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AppXSvc
  5. 在右侧双击开始
  6. 把它设置为2(自动启动
  7. 按确定
  8. 重启你的电脑。

你没有任何修理或任何东西就完成了它


not*_*bit 6

除了已经提到的有关确保服务正在运行/启动的内容之外,您可能需要使用带有交换机的旧加载模式-UseWindowsPowerShell

\n

在此输入图像描述

\n

打开管理员powershell:

\n
# Get-AppxPackage Microsoft.YourPhone -AllUsers\n\nGet-AppxPackage: The \'Get-AppxPackage\' command was found in the module \'Appx\', but the module could not be loaded.  \nFor more information, run \'Import-Module Appx\'.\n\n# Import-Module Appx\n\nImport-Module: Operation is not supported on this platform. (0x80131539)\n\n# Import-Module Appx -UseWinPS\n\nWARNING: Module Appx is loaded in Windows PowerShell using WinPSCompatSession remoting session; \nplease note that all input and output of commands from this module will be deserialized objects. \nIf you want to load this module into PowerShell please use \'Import-Module -SkipEditionCheck\' syntax.\n\n\n# Get-AppxPackage -AllUsers | Select Name, PackageFullName\n\n...\nMicrosoft.SkypeApp                     Microsoft.SkypeApp_15.68.96.0_x86__kzf8qxf38zg5c\nMicrosoft.MicrosoftSolitaireCollection Microsoft.MicrosoftSolitaireCollection_4.9.1252.0_x64__8wekyb3d8bbwe\nMicrosoft.YourPhone                    Microsoft.YourPhone_1.21011.127.0_x64__8wekyb3d8bbwe\n...\n\n
Run Code Online (Sandbox Code Playgroud)\n

您现在可以按预期使用命令,例如删除软件包YourPhone等。

\n
# Get-AppxPackage Microsoft.YourPhone -AllUsers\n\nRunspaceId             : 90cab3d8-569d-4cf8-8f27-b42fbad4634e\nName                   : Microsoft.YourPhone\nPublisher              : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US\nPublisherId            : 8wekyb3d8bbwe\nArchitecture           : X64\nResourceId             :\nVersion                : 1.21011.127.0\nPackageFamilyName      : Microsoft.YourPhone_8wekyb3d8bbwe\nPackageFullName        : Microsoft.YourPhone_1.21011.127.0_x64__8wekyb3d8bbwe\nInstallLocation        : C:\\Program Files\\WindowsApps\\Microsoft.YourPhone_1.21011.127.0_x64__8wekyb3d8bbwe\nIsFramework            : False\nPackageUserInformation : {xxxxx: Installed}\nIsResourcePackage      : False\nIsBundle               : False\nIsDevelopmentMode      : False\nNonRemovable           : False\nDependencies           : {Microsoft.UI.Xaml.2.5_2.52012.2002.0_x64__8wekyb3d8bbwe,\n                         Microsoft.NET.Native.Framework.2.2_2.2.29512.0_x64__8wekyb3d8bbwe,\n                         Microsoft.NET.Native.Runtime.2.2_2.2.28604.0_x64__8wekyb3d8bbwe,\n                         Microsoft.VCLibs.140.00_14.0.30704.0_x64__8wekyb3d8bbwe\xe2\x80\xa6}\nIsPartiallyStaged      : False\nSignatureKind          : Store\nStatus                 : Ok\n
Run Code Online (Sandbox Code Playgroud)\n

有关更多详细信息,请参阅此处的问题讨论。

\n