如何使用 Powershell 取消固定 Windows 10 开始菜单广告

Roy*_*tty 5 windows powershell windows-10

我不时为某人准备一台新 PC,并认为我可以使用 powershell 从菜单开始取消固定程序和广告。它起作用了,但只是部分起作用。我能够取消固定日历和天气等程序,但不知道如何摆脱像 Asphalt 8: Airborne 这样的 Windows 商店游戏广告:

在此处输入图片说明

我应该在脚本中包含什么名称来取消固定那个东西(和类似的东西)?

这是我使用的脚本:

function Pin-App {    param(
        [string]$appname,
        [switch]$unpin
    )
    try{
        if ($unpin.IsPresent){
            ((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -eq $appname}).Verbs() | ?{$_.Name.replace('&','') -match 'Von "Start" lösen|Unpin from Start'} | %{$_.DoIt()}
            return "App '$appname' unpinned from Start"
        }else{
            ((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -eq $appname}).Verbs() | ?{$_.Name.replace('&','') -match 'An "Start" anheften|Pin to Start'} | %{$_.DoIt()}
            return "App '$appname' pinned to Start"
        }
    }catch{
        Write-Error "Error Pinning/Unpinning App! (App-Name correct?)"
    }
}

Pin-App "Mail" -unpin
Pin-App "Store" -unpin
Pin-App "Calendar" -unpin
Pin-App "Microsoft Edge" -unpin
Pin-App "Photos" -unpin
Pin-App "Cortana" -unpin
Pin-App "Weather" -unpin
Pin-App "Phone Companion" -unpin
Pin-App "Twitter" -unpin
Pin-App "Skype Video" -unpin
Pin-App "Candy Crush Soda Saga" -unpin
Pin-App "xbox" -unpin
Pin-App "Groove music" -unpin
Pin-App "films & tv" -unpin
Pin-App "microsoft solitaire collection" -unpin
Pin-App "money" -unpin
Pin-App "get office" -unpin
Pin-App "onenote" -unpin
Pin-App "news" -unpin
Pin-App "Asphalt 8: Airborne" -unpin
Pin-App "This PC" -pin
Run Code Online (Sandbox Code Playgroud)

dan*_*gph 1

如果您想部署标准化的开始菜单,您可以使用Export-StartLayoutImport-StartLayout

  1. 按照您想要的方式在测试机上手动设置开始菜单。
  2. 将该布局导出到 XML 文件,扩展名为Export-StartLayout.
  3. 将该文件导入到其他计算机上Import-StartLayout

微软提供了更多详细信息:

https://blogs.technet.microsoft.com/deploymentguys/2016/03/07/windows-10-start-layout-customization/