Wednesday, March 14, 2018

Windows 10 STARTMENU TILE cleanup français

Enfin!

Un vrai nettoyage du startmenu windows 10 français

Powershell script (cleanupstartmenuwin10.ps1)


List all action possibles for an app:
$items01 = (New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items()
foreach($item01 in $items01)
{
    if ($item01.name -eq "excel")
    {
        write-host $item01.name
        $verbs01 = $item01.verbs()
        foreach($verb01 in $verbs01)
        {
            write-host $verb01.Name
        }
           
    }
}




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

function Pin-App
{ param(
 [string]$appname,
 [switch]$unpin
 )
 try{
     if ($unpin.IsPresent)
        {
        $action01 = "Désépingler|Désépingler de la page d'accueil"
        #((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()}
        ((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -eq $appname}).Verbs() | ?{$_.Name.replace('&','') -match 'From "Start" ' + $action01} | %{$_.DoIt()}
        #$action01 = "Détacher|Détacher du menu démarrer"
        #((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -eq $appname}).Verbs() | ?{$_.Name.replace('&','') -match 'From "Start" ' + $action01} | %{$_.DoIt()}
        #((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -eq $appname}).Verbs()
       
        return "App '$appname' unpinned from Start"
        }
        else
        {
        $action02 = "Épingler|Épingler à l’écran de démarrage"
        #((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -eq $appname}).Verbs()
        ((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -eq $appname}).Verbs() | ?{$_.Name.replace('&','') -match 'To "Start" ' + $action02} | %{$_.DoIt()
        }
        return "App '$appname' pinned to Start"
        }
    }
    catch
    {
    }
 }

 ############### Unpin All Apps
# shortcuts
 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
        #$name
        #((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -eq $name}).Verbs()
 }
# apps
 foreach ( $item in $layoutfile.LayoutModificationTemplate.DefaultLayoutOverride.StartLayoutCollection.StartLayout.Group.Tile.AppUserModelID)
 {
        $outputFile = Split-Path $item -leaf
        $name = $outputFile | Select-Object -first 1
        #Pin-App "$name" -unpin
        $name
        $action01 = "Désépingler|Désépingler de la page d'accueil"
        #((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Path -eq $name}).Verbs() | ?{$_.Name.replace('&','') -match 'From "Start" ' + $action01}
       
       
        ((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Path -eq $name}).Verbs() | ?{$_.Name.replace('&','') -match 'From "Start" ' + $action01} | %{$_.DoIt()}
 }
# PUB
 foreach ( $item in $layoutfile.LayoutModificationTemplate.DefaultLayoutOverride.StartLayoutCollection.StartLayout.Group.SecondaryTile.AppUserModelID)
 {
        $outputFile = Split-Path $item -leaf
        $name = $outputFile | Select-Object -first 1
        #Pin-App "$name" -unpin
        $name
        $action01 = "Désépingler|Désépingler de la page d'accueil"
        #((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Path -eq $name}).Verbs()
       
        ((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Path -eq $name}).Verbs() | ?{$_.Name.replace('&','') -match 'From "Start" ' + $action01} | %{$_.DoIt()}
 }

 ############### PIN YOUR FAVORITE APPS
 Pin-App "Netflix" -pin
 #Pin-App "Photos" -pin
 #Pin-App "Calculatrice" -pin
 #Pin-App "Snipping Tool" -pin
 #Pin-App "Notepad" -pin
 Pin-App "Explorateur de fichiers" -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


### remove menu item, app, lock future installation
write-host "=== will remove menu icon, delete app, prevent futur install"

$listonly01 = 0

[string[]]$items02="http://java.com/help"
$items02+="MicrosoftSolitaireCollection_8wekyb3d8bbwe"
$items02+="MSPaint_8wekyb3d8bbwe"
$items02+="Microsoft3DViewer_8wekyb3d8bbwe"
$items02+="XboxApp_8wekyb3d8bbwe"
$items02+="ZuneMusic_8wekyb3d8bbwe"
$items02+="ZuneVideo_8wekyb3d8bbwe"
$items02+="MicrosoftOfficeHub_8wekyb3d8bbwe"
$items02+="http://java.com/"
$items02+="asphalt*8*airborne"
$items02+="marchofempire"
$items02+="bubblewitch3saga"
$items02+="candycrushsodasaga"
$items02+="asphalt*8*airborne"
$items02+="minecraft"
$items02+="xbox"

$action01 = "*Détacher de l*écran d*accueil*"

foreach ($item02 in $items02)
    {
    if ($listonly01 -eq 1)
        {
        ((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | select name, path | where-object {$_.path –like "*$item02*" -or $_.name –like "*$item02*"})
        }
        else
        {
        #write-host $action01 ":" $item02
# not working see up for the real one working     
#((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | where-object {$_.path –like "*$item02*"}).Verbs() | ?{$_.Name.replace('&','') -like "$action01"} | %{$_.doit()}
     
        write-host "removing: " $item02
        (Get-AppxPackage -allusers | where-object {$_.name –like "*$item02*" -or $_.PackageFamilyName –like "*$item02*"}) | Remove-AppxPackage
     
        write-host "removing online install: " $item02
        Get-appxprovisionedpackage –online | where-object {$_.name –like "*$item02*" -or $_.PackageFamilyName –like "*$item02*"} | remove-appxprovisionedpackage –online
        }
    }