![Powershell Get-AppxPackage 不起作用](https://linux22.com/image/1596600/Powershell%20Get-AppxPackage%20%E4%B8%8D%E8%B5%B7%E4%BD%9C%E7%94%A8.png)
这是错误: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
通过 services.msc 禁用的服务是什么?是哪一个?
答案1
另一个答案指出的问题是因为 AppX 部署服务被禁用。以下是启用它的方法:
- 按 Win + R
- 写入注册表
- 按 Enter 键
- 转到计算机\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AppXSvc
- 在右侧双击开始
- 将其设为 2 (自动启动)
- 按确定
- 重启你的电脑。
你没有做任何修复或任何事情就做到了
答案2
除了已经提到的确保您的服务正在运行/启动之外,您可能还需要使用带有开关的传统加载模式-UseWindowsPowerShell
。
打开行政电源外壳:
# Get-AppxPackage Microsoft.YourPhone -AllUsers
Get-AppxPackage: The 'Get-AppxPackage' command was found in the module 'Appx', but the module could not be loaded.
For more information, run 'Import-Module Appx'.
# Import-Module Appx
Import-Module: Operation is not supported on this platform. (0x80131539)
# Import-Module Appx -UseWinPS
WARNING: Module Appx is loaded in Windows PowerShell using WinPSCompatSession remoting session;
please note that all input and output of commands from this module will be deserialized objects.
If you want to load this module into PowerShell please use 'Import-Module -SkipEditionCheck' syntax.
# Get-AppxPackage -AllUsers | Select Name, PackageFullName
...
Microsoft.SkypeApp Microsoft.SkypeApp_15.68.96.0_x86__kzf8qxf38zg5c
Microsoft.MicrosoftSolitaireCollection Microsoft.MicrosoftSolitaireCollection_4.9.1252.0_x64__8wekyb3d8bbwe
Microsoft.YourPhone Microsoft.YourPhone_1.21011.127.0_x64__8wekyb3d8bbwe
...
您现在可以按预期使用命令,例如删除YourPhone
包等。
# Get-AppxPackage Microsoft.YourPhone -AllUsers
RunspaceId : 90cab3d8-569d-4cf8-8f27-b42fbad4634e
Name : Microsoft.YourPhone
Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
PublisherId : 8wekyb3d8bbwe
Architecture : X64
ResourceId :
Version : 1.21011.127.0
PackageFamilyName : Microsoft.YourPhone_8wekyb3d8bbwe
PackageFullName : Microsoft.YourPhone_1.21011.127.0_x64__8wekyb3d8bbwe
InstallLocation : C:\Program Files\WindowsApps\Microsoft.YourPhone_1.21011.127.0_x64__8wekyb3d8bbwe
IsFramework : False
PackageUserInformation : {xxxxx: Installed}
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
Dependencies : {Microsoft.UI.Xaml.2.5_2.52012.2002.0_x64__8wekyb3d8bbwe,
Microsoft.NET.Native.Framework.2.2_2.2.29512.0_x64__8wekyb3d8bbwe,
Microsoft.NET.Native.Runtime.2.2_2.2.28604.0_x64__8wekyb3d8bbwe,
Microsoft.VCLibs.140.00_14.0.30704.0_x64__8wekyb3d8bbwe…}
IsPartiallyStaged : False
SignatureKind : Store
Status : Ok
更多详情,请参阅问题讨论这里。
答案3
通过 services.msc 禁用的服务是什么?是哪一个?
安装 Windows Store UWP 应用程序需要以下服务
- 客户端许可服务 (ClipSVC)
- AppX 部署服务 (AppXSVC)