需要帮助才能通过PowerShell删除默认的Windows 10应用程序

时间:2017-08-15 08:42:57

标签: windows powershell windows-store-apps

我试图通过在PowerShell脚本中运行以下命令来推卸Windows 10 Education。我可以让脚本删除已登录用户的应用程序,但只要有新用户登录,应用程序就会重新出现。

这是我的剧本:

Get-AppxPackage -AllUsers | where-object {$_.name –like “*3DBuilder*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*windowsalarms*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*windowscamera*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*windowscommunicationsapps*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*officehub*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*getstarted*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*windowsmap*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*solitairecollection*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*bingfinance*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*bingnews*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*zunevideo*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*people*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*windowsphone*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*bingsports*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*windowsstore*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*soundrecorder*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*bingweather*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*xboxapp*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*Appconnector*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*MinecraftUWP*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*Messaging*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*WindowsFeedbackHub*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*Getstarted*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*GetHelp*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*ContactSupport*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*Wallet*”} | Remove-AppxPackage
Get-AppxPackage -AllUsers | where-object {$_.name –like “*OneConnect*”} | Remove-AppxPackage

非常感谢任何建议。

2 个答案:

答案 0 :(得分:3)

我不是100%肯定,但我认为你需要使用-Online参数

$Apps = Get-AppxProvisionedPackage -Online
$Apps | Where-Object {$_.DisplayName -like "*windowscommun*"} | Remove-AppxProvisionedPackage -Online

答案 1 :(得分:-1)

您在-AllUsers上设置了Get-AppxPackage开关,但在Remove-AppxPackage上没有设置。如果确实将其添加到每行的末尾,则应该获得预期的行为。请注意,我认为你不需要第一个AllUsers开关,但保持它不会受到伤害(不包括它可能会使命令花费更长的时间来完成。)

Get-AppxPackage -AllUsers | where-object {$_.name –like “*3DBuilder*”} | Remove-AppxPackage -AllUsers