Share via


Clean pinned start menu apps with powershell

Question

Tuesday, May 23, 2017 5:12 AM

Work in progress, almost there. Just the factory installed pinned apps are formatted really badly in the xml file.

############### Functions

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{

 }
 }

 ############### Unpin All Apps
 
 Export-StartLayout –path C:\startscreenlayout.xml
 [xml]$layoutfile = Get-Content C:\startscreenlayout.xml

 foreach ( $item in $layoutfile.LayoutModificationTemplate.DefaultLayoutOverride.StartLayoutCollection.StartLayout.Group.DesktopApplicationTile.DesktopApplicationLinkPath)
 {
        $outputFile = Split-Path $item -leaf
        $name = $outputFile.split('.') | Select-Object -first 1
        Pin-App "$name" -unpin     
 }

 
 ############### PIN YOUR FAVORITE APPS
 Pin-App "Google Chrome" -pin
 Pin-App "Photos" -pin
 Pin-App "Calculator" -pin
 Pin-App "Snipping Tool" -pin
 Pin-App "Notepad" -pin
 Pin-App "File Explorer" -pin
 Pin-App "Word 2013" -pin
 Pin-App "Excel 2013" -pin
 Pin-App "Outlook 2013" -pin
 Pin-App "Powerpoint 2013" -pin
 Pin-App "Word 2016" -pin
 Pin-App "Excel 2016" -pin
 Pin-App "Outlook 2016" -pin
 Pin-App "Powerpoint 2016" -pin

All replies (2)

Wednesday, May 24, 2017 2:11 AM

Hi,

It's not recommended that you use this method.

The easiest method for creating a customized Start layout to apply to other Windows 10 devices is to set up the Start screen on a test computer and then export the layout.

After you export the layout, decide whether you want to apply a full Start layout or a partial Start layout.

When a full Start layout is applied, the users cannot pin, unpin, or uninstall apps from Start. Users can view and open all apps in the All Apps view, but they cannot pin any apps to Start.

When a partial Start layout is applied, the contents of the specified tile groups cannot be changed, but users can move those groups, and can also create and customize their own groups.

Note: Partial Start layout is only supported on Windows 10, version 1511 and later.

For the detailed information, please read this article to know how to do that:

Customize and export Start layout

/en-us/windows/configuration/customize-and-export-start-layout

If you insist on using the PowerShell method, please post in PowerShell forum for more help.

https://social.technet.microsoft.com/Forums/windows/en-US/home?forum=winserverpowershell

Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact [email protected].


Monday, December 17, 2018 8:15 PM

How about MSFT just not automatically pin ANYTHING to start?

This worked for us.  I suppose MSFT just recommend you keep taking their face punches too.