我不时为某人准备一台新 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 …Run Code Online (Sandbox Code Playgroud)