
時々、誰かのために新しい 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
答え1
標準化されたスタート メニューを展開する場合は、Export-StartLayout
と を使用できますImport-StartLayout
。
- テスト マシンのスタート メニューを手動で希望どおりに設定します。
- そのレイアウトを で XML ファイルにエクスポートします
Export-StartLayout
。 - そのファイルを他のコンピュータにインポートします
Import-StartLayout
。
Microsoft からの詳細情報は、こちらにあります:
https://blogs.technet.microsoft.com/deploymentguys/2016/03/07/windows-10-start-layout-customization/
答え2
これは、MDT を使用してカスタム スタート メニュー レイアウトを Windows 10 にプッシュするために PowerShell で作成した単純なものです。展開中に MDT が XML を temp フォルダーに展開することから始まります。
Clear-Host
# file path that the xml must live in
$filepath = "C:\users\default\AppData\Local\Microsoft\Windows\Shell"
# xml files that were copied to local machine
$startxmlorig = "C:\Windows\Temp\startandtaskbar.xml"
$layoutmod = "C:\Windows\Temp\LayoutModification.xml"
# test the path to see if it exists if yes then copy xmls to correct folder on if not then create the path and copy the xml files to the correct path.
if (!(Test-Path -Path $filepath)) {
Copy-Item -Path $startxmlorig -Destination $filepath
Copy-Item -Path $layoutmod -Destination $filepath
} else {
New-Item -Force -ItemType Directory -Path $filepath
Copy-Item -Path $startxmlorig -Destination $filepath
Copy-Item -Path $layoutmod -Destination $filepath`