Im making a script that cleans a fresh install of windows 11 to my liking. Does anybody know of a way to unpin all apps in start menu using PowerShell? I have found scripts but those scripts are name dependent, what if windows just feels to include a new app there.
I have read that the pinned apps are inside the
%LocalAppData%\Packages\Microsoft.Windows.StartMenuExperienceHost_cw5n1h2txyewy\LocalState
But when i went to this location, its a binary :( i would have thought that here contains all the shortcuts but i guess not
I know where all start menu apps are : C:\ProgramData\Microsoft\Windows\Start Menu\Programs
, but i dont care about that since its not front and center, its those pinned apps that i would like to remove
EDIT:
Frankensteining some 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?): '$appname'" }}$list = (Get-StartApps).Name; @($list).Countforeach ($item in $list) { Pin-App $item -unpin};
This seem to work but it started unpinning some weird stuff for example
App 'Firefox' unpinned from Start
but firefox is still here