≡ Menu

Query Start menu groups and Pinned programs in Windows 8.1 using PowerShell

The PowerShell script discussed in this article will help in querying Programs and groups pinned to start menu in Windows 8.1 metro UI. It also gives their size and the executable that it is pointing.

Windows 8.1 has a PowerShell cmdlet, Export-StartLayout, that helps in exporting the current UI setting. This will export Start Menu items along with their group name and size to XML file (or bin file). Parsing this XML file will help in reading the list of applications that are currently pinned to start menu.

The below code will export the details to XML file and read details from it to produce output in Object format. The details will contains, application name, group that it belongs, size of the icon in start menu, and fensepost value (not sure what it represents as I am writing this. Will search for it later).

CODE: Get-StartMenuItems.ps1

[cmdletbinding()]            
param(            
)            
$XMLPath = Join-Path $env:temp "startmenu.xml"            
            
Export-StartLayOut -As XML -Path $XMLPath            
$Content = Get-Content $XMLPath            
$Groups = $Content.GetElementsByTagName("group")            
foreach($Group in $Groups) {            
 #$Group.Getenumerator()            
            
 $Tiles = $Group.Getenumerator()            
 $GroupName = $Group.Name            
 foreach($Tile in $Tiles) {            
            
  $AppID = $Tile.AppID            
  $Size = $Tile.size            
  $FensePost = $Tile.FencePost            
  $OutputObj = New-Object -TypeName PSobject            
  $OutputObj | Add-Member -MemberType NoteProperty -Name GroupName -Value $GroupName            
  $OutputObj | Add-Member -MemberType NoteProperty -Name AppID -Value $AppID            
  $OutputObj | Add-Member -MemberType NoteProperty -Name AppSize -Value $Size            
  $OutputObj | Add-Member -MemberType NoteProperty -Name FensePost -Value $FensePost            
  $OutputObj            
              
 }            
            
            
}            

Output:

startmenuitems

This script is available at TechNet Gallery… http://gallery.technet.microsoft.com/Get-start-menu-items-in-df4158c7