How to automatically (cmd/powershell script) unpin all apps in start

Page 1 of 3 123 LastLast

  1. Posts : 4
    Windows 10 Home x64
       #1

    How to automatically (cmd/powershell script) unpin all apps in start


    Hi.

    I would like to automatize cleaning the Windows 10's start menu from all these default pinned apps that I'm not using. I don't want to remove apps, only unpin from from start.

    I tried to google help, but didn't find any. There seems to be no command to pin and unpin apps in start menu. Any alternative methods? The information about the configuration of start menu must be stored somewhere, so has anyone found a way to hack this information?
      My Computer


  2. Posts : 73
    Windows
       #2

    I want to do this too and I remember reading of a way, however I might be mistaken. Hopefully, someone will respond and let us know.
      My Computer


  3. Posts : 4
    Windows 10 Home x64
    Thread Starter
       #3

    I found a PowerShell script on a german website that does the job:
    Powershell: Windows 10 Modern Apps an Startmenü anheften oder entfernen (Pin oder Unpin) - administrator.de


    Code:
    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 "movies & 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

    The syntax is simply Pin-App "appname" -unpin
    Now the problem is that I can't remove all pinned apps, because I don't know their names. There are still these three shortcuts to Store remaining, iHeartRadio, Minecraft and Flipboard.

      My Computer


  4. Posts : 1
    Windows 10
       #4

    Thank you proguru. Here is the same thing in English.

    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 'From "Start" UnPin|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 'To "Start" Pin|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 "Music" -unpin
    Pin-App "xbox" -unpin
    Pin-App "movies & 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 "Mail" -pin
    Pin-App "Store" -pin
    Pin-App "Calendar" -pin
    Pin-App "Microsoft Edge" -pin
    Pin-App "Photos" -pin
    Pin-App "Cortana" -pin
    Pin-App "Weather" -pin
    Pin-App "Phone Companion" -pin
    Pin-App "Music" -pin
    Pin-App "xbox" -pin
    Pin-App "movies & tv" -pin
    Pin-App "microsoft solitaire collection" -pin
    Pin-App "money" -pin
    Pin-App "get office" -pin
    Pin-App "onenote" -pin
    Pin-App "news" -pin
      My Computer


  5. Posts : 3
    Windows 7 and 10
       #5

    This powershell script is exactly what I need to solve a problem here at work, but I'm having problems testing it. I need to run it against PCs to remove the shortcuts to install Flipboard, Minecraft and Adobe Photoshop Express. I've taken the above, remmed out all of the Pin/Unpin statements that came with it, and added three lines to unpin the shortcuts mentioned and I get the errors shown below. It's acting as if the app name isn't correct, but as far as I can tell it is.

    How to automatically (cmd/powershell script) unpin all apps in start-win-10-unpinerror.png
      My Computer


  6. Posts : 5
    Windows 10
       #6

    This tells me, "App 'Microsoft Edge' unpinned from Start" ... but it's not
      My Computer


  7. Posts : 5
    Windows 10
       #7

    Nevermind, I see the script was designed to unpin from Start, not taskbar. Simply replacing "unpinned from Start" to "unpinned from taskbar" works. Spent many hours on this searching all over the internet. This is the best solution as it does not require killing explorer.exe!

    Here is an altered version of the script above:

    Code:
    function Pin-App ([string]$appname, [switch]$unpin, [switch]$start, [switch]$taskbar, [string]$path) {
        if ($unpin.IsPresent) {
            $action = "Unpin"
        } else {
            $action = "Pin"
        }
        
        if (-not $taskbar.IsPresent -and -not $start.IsPresent) {
            Write-Error "Specify -taskbar and/or -start!"
        }
        
        if ($taskbar.IsPresent) {
            try {
                $exec = $false
                if ($action -eq "Unpin") {
                    ((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -eq $appname}).Verbs() | ?{$_.Name.replace('&','') -match 'Unpin from taskbar'} | %{$_.DoIt(); $exec = $true}
                    if ($exec) {
                        Write "App '$appname' unpinned from Taskbar"
                    } else {
                        if (-not $path -eq "") {
                            Pin-App-by-Path $path -Action $action
                        } else {
                            Write "'$appname' not found or 'Unpin from taskbar' not found on item!"
                        }
                    }
                } else {
                    ((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -eq $appname}).Verbs() | ?{$_.Name.replace('&','') -match 'Pin to taskbar'} | %{$_.DoIt(); $exec = $true}
                    
                    if ($exec) {
                        Write "App '$appname' pinned to Taskbar"
                    } else {
                        if (-not $path -eq "") {
                            Pin-App-by-Path $path -Action $action
                        } else {
                            Write "'$appname' not found or 'Pin to taskbar' not found on item!"
                        }
                    }
                }
            } catch {
                Write-Error "Error Pinning/Unpinning $appname to/from taskbar!"
            }
        }
        
        if ($start.IsPresent) {
            try {
                $exec = $false
                if ($action -eq "Unpin") {
                    ((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -eq $appname}).Verbs() | ?{$_.Name.replace('&','') -match 'Unpin from Start'} | %{$_.DoIt(); $exec = $true}
                    
                    if ($exec) {
                        Write "App '$appname' unpinned from Start"
                    } else {
                        if (-not $path -eq "") {
                            Pin-App-by-Path $path -Action $action -start
                        } else {
                            Write "'$appname' not found or 'Unpin from Start' not found on item!"
                        }
                    }
                } else {
                    ((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -eq $appname}).Verbs() | ?{$_.Name.replace('&','') -match 'Pin to Start'} | %{$_.DoIt(); $exec = $true}
                    
                    if ($exec) {
                        Write "App '$appname' pinned to Start"
                    } else {
                        if (-not $path -eq "") {
                            Pin-App-by-Path $path -Action $action -start
                        } else {
                            Write "'$appname' not found or 'Pin to Start' not found on item!"
                        }
                    }
                }
            } catch {
                Write-Error "Error Pinning/Unpinning $appname to/from Start!"
            }
        }
    }
    
    function Pin-App-by-Path([string]$Path, [string]$Action, [switch]$start) {
        if ($Path -eq "") {
            Write-Error -Message "You need to specify a Path" -ErrorAction Stop
        }
        if ($Action -eq "") {
            Write-Error -Message "You need to specify an action: Pin or Unpin" -ErrorAction Stop
        }
        if ((Get-Item -Path $Path -ErrorAction SilentlyContinue) -eq $null){
            Write-Error -Message "$Path not found" -ErrorAction Stop
        }
        $Shell = New-Object -ComObject "Shell.Application"
        $ItemParent = Split-Path -Path $Path -Parent
        $ItemLeaf = Split-Path -Path $Path -Leaf
        $Folder = $Shell.NameSpace($ItemParent)
        $ItemObject = $Folder.ParseName($ItemLeaf)
        $Verbs = $ItemObject.Verbs()
        
        if ($start.IsPresent) {
            switch($Action){
                "Pin"   {$Verb = $Verbs | Where-Object -Property Name -EQ "&Pin to Start"}
                "Unpin" {$Verb = $Verbs | Where-Object -Property Name -EQ "Un&pin from Start"}
                default {Write-Error -Message "Invalid action, should be Pin or Unpin" -ErrorAction Stop}
            }
        } else {
            switch($Action){
                "Pin"   {$Verb = $Verbs | Where-Object -Property Name -EQ "Pin to Tas&kbar"}
                "Unpin" {$Verb = $Verbs | Where-Object -Property Name -EQ "Unpin from Tas&kbar"}
                default {Write-Error -Message "Invalid action, should be Pin or Unpin" -ErrorAction Stop}
            }
        }
        
        if($Verb -eq $null){
            Write-Error -Message "That action is not currently available on this Path" -ErrorAction Stop
        } else {
            $Result = $Verb.DoIt()
        }
    }
    
    Pin-App "Microsoft Edge" -unpin -taskbar
    note: Even though I have built in ways of pinning apps to the taskbar to this script, it is not functional as MS has removed the "Pin to taskbar" verbs, and I cannot find a scriptable workaround. Ref: PSA: Win10 removes support for scripting verb - Windows 10 - Spiceworks
      My Computer


  8. Posts : 4
    win10 mostly
       #8

    Had the same problem as BryanP. The script would not remove all of the live tiles. No matter what I tried, especially annoying ones like Twitter and Candy Crush Soda Sage were always left behind.

    A slight modification to the script allowed me to unpin tiles indiscriminately. To do this, remove the "-eq $appname" from the 7th line, so it reads like so:

    ((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name}).Verbs() | ?{$_.Name.replace('&','') -match 'Von "Start" lösen|Unpin from Start'} | %{$_.DoIt()}

    Unfortunately, even this technique failed to remove a handful of tiles. I was even more baffled because the apps that remained were not installed on the device. Finally, I realized that the only way for an app to show up in the CLSID list used by the powershell command is for them to be installed on the computer. Since I had uninstalled all the bloatware from my image, I am now unable to quickly remove the live tiles for said bloatware because Windows 10 thinks I need to use Twitter and play Candy Crush so badly that it brings them back from the dead every time I image a machine or create a new account.

    I fail to understand why there is no control panel option to simply turn off live tiles in one fell swoop.

    If any knows a better solution to automate this process please share it. There has to be a folder hidden somewhere in ProgramData or AppData that the live tiles are referencing.
      My Computer


  9. Posts : 5,478
    2004
       #9

    GeneralG said:
    There has to be a folder hidden somewhere in ProgramData or AppData that the live tiles are referencing.
    It is in %localappdata%\TileDataLayer\Database but I don't know the structure.

    What you can do though is Import-StartLayout into a mounted windows image or define the start layout in group policy if either of these approaches would help...

    How to automatically (cmd/powershell script) unpin all apps in start-capture.png
      My Computer


  10. Posts : 4
    win10 mostly
       #10

    Thanks lx07,

    After further research, I came across the same solution on my own. The following link does a fantastic job of explaining Start Layout customization:

    https://winpeguy.wordpress.com/2015/...ltlayouts-xml/

    I was having difficulties using the Start Layout group policy and the powershell import-startlayout, so instead I modified the DefaultLayouts.xml directly. This file is located in directory "C:\Users\Default\AppData\Local\Microsoft\Windows\Shell".
    Now when I create a new local user, gone are all those aggravating tiles that reference nonexistent preinstalled apps. I'm still working on perfecting it, as my current version does leave behind Edge, Store, and Settings tiles. I also still need to try including the DefaultLayouts.xml in my image and seeing if I can get it to apply to the Administrator account.

    Also I saw the file you referenced "%localappdata%\TileDataLayer\Database" but I am unsure how to use it. Modifying the DefaultLayouts.xml seems like the way to go since that is, more or less, what using powershell to import a start layout does according to the article I linked.
    Last edited by GeneralG; 30 Sep 2016 at 13:49.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 15:38.
Find Us




Windows 10 Forums