web-dev-qa-db-ja.com

PowerShellでWindows 10スタートメニュー広告の固定を解除する方法

時々、誰かのために新しいPCを準備し、メニューからプログラムや広告の固定を解除して、PowerShellを使い始めることができると思いました。それは機能しましたが、部分的にしか機能しませんでした。 Calendar&Weatherのようなプログラムの固定を解除することはできましたが、Asphalt 8:Airborne:のようなWindowsストアのゲーム広告を取り除く方法がわかりませんでした。

enter image description here

そのこと(および同様のもの)の固定を解除するには、スクリプトにどのような名前を含める必要がありますか?

私が使用するスクリプトは次のとおりです。

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
5
Roy_Batty

標準化されたスタートメニューを展開する場合は、Export-StartLayoutおよびImport-StartLayoutを使用できます。

  1. テストマシンのスタートメニューを希望どおりに手動で設定します。
  2. そのレイアウトをExport-StartLayoutを使用してXMLファイルにエクスポートします。
  3. そのファイルをImport-StartLayoutを使用して他のコンピューターにインポートします。

ここにマイクロソフトの詳細があります:

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

1
dangph

これは、PowerShellを使用して作成した単純なもので、MDTを使用してカスタムスタートメニューレイアウトをWindows 10にプッシュします。これは、展開中にXMLを一時フォルダーに展開するMDTから始まります。

    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`
1
Jason Santoro