Friday, April 25, 2014

Pinning Apps to the Start Screen in Windows 8.1 Registry Setting, Group Policy, C#, Visual Studio

Pinning Apps to the Start Screen in Windows 8.1

Installing new applications in Windows 8.0, would result in a tile being automatically pined to the Start Screen, which resulted in a very wide screen to scroll. 
To combat this, Windows 8.1 decided to categorize our Apps for us (by name, by date installed, by usage and by category). In this thread I am installing XML Notepad 2007 (shout-out: udpate this app!)
Under Windows 8.1 apps are 
no longer automatically pinned to the Start Menu and it is therefore up to the user to manually pin the apps to the Start Screen. 


Wisely, Microsoft has provisioned for enabling applications to be pinned to the user’s Start Screen, but it's not easy for a developer. Ideally, it would be placed in the App's Manifest
AppxManifest.xml or {YourAppName}.VisualElementsManifest.xml along with other pin target locations, but that would be to logical. 


A new 
Group Policy setting to pin specified applications to the Start Screen has been introduced.  The “Pin Apps to Start when Installed” policy allows enterprises to have a level of freedom in customizing their own Start Screen whilst ensuring that a standard set of corporate applications are pinned to the Start Screen.

Windows 8.1 has introduced 5 new Start Menu Group Policy Objects/Registry settings in relation to the Windows 8 Start Menu. You can find them by searching for these values in the registry;
  1. StartPinAppsWhenInstalled
  2. LockedStartLayout
  3. GotoDesktopOnSignin
  4. ShowAppsViewOnStart
  5. DisableGlobalSearchOnAppsView

In Group Policy Editor (gpedit.msc) Pin Apps to Start when Installed”  which is an Administrative Template.Administrative Templates / Start Menu and Task bar / Pin Apps to Start when Installed 


The policy requires the individual AppID’s to be specified in the policy and is located in the following location (User or Computer configuration).
Many of the AppIDs have namespaces (like Microsoft.InternetExplorer.Default) that we might expect to see in an App Package Manifest, but the XML Notepad AppID is different. 
It represents a file system location.

  {7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}\XML Notepad 2007\XmlNotepad.exe
Is the same as on a 64-bit machine; 
  C:\Program Files (x86)\XML Notepad 2007\XmlNotepad.exe

and what  a 32-bit machine,
  C:\Program Files\XML Notepad 2007\XmlNotepad.exe

The policy requires an AppID per shortcut and this can be obtained from the XML generated by running the following PowerShell command on the reference computer:
Export-StartLayout –As XML –Path .\MyStartMenuLayout.xml

Get-StartApps   - gets a full list of AppIDs
You can also run the Get-StartApps CmdLet to list all the applications (with their AppID’s) currently pinned on the logged on user’s Start Screen.
Windows 8+ now uses “Known Folder ID’s” which are an evolution from the earlier CSIDL folders used in mapping an alias to a physical file location on a local drive.

So {7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E} represents the Program Files (x86) folder many those are list at

For developers, since GPO is just a registry setting, you can programmatically 
pin installed Apps to the Start Screen by setting this Windows 8.1 Registry Setting before hand using this registry key;

  1. HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Group Policy Objects\{8E168A82-6D8B-435B-88AA-96557FEE449E}Machine\Software\Policies\Microsoft\Windows\Explorer\StartPinAppsWhenInstalled
  2. HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Explorer\StartPinAppsWhenInstalled
  3. HKEY_USERS\S-1-5-21-2968750198-2704521508-3360548841-1001\Software\Microsoft\Windows\CurrentVersion\Group Policy Objects\{8E168A82-6D8B-435B-88AA-96557FEE449E}Machine\Software\Policies\Microsoft\Windows\Explorer\StartPinAppsWhenInstalled
Add String Key="1"
with
Value="{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}\XML Notepad 2007\XmlNotepad.exe"


And finally, after setting the above and re-installing XML Notepad, you get the desired result. 



3 comments:

  1. Is there anyway this can work with applications that are already installed without reinstalling them ?

    ReplyDelete
  2. I cannot, for the life of me, get this to work on Windows 8.1 Professional or Windows 10 Enterprise. Perhaps one of the newer patches removed this "functionality"? Do you have any idea?

    Fred

    ReplyDelete
    Replies
    1. That is correct Fred, new items are not pinned to the Start Screen, but you have to scroll down to the Apps by Category area now and manually set this to appear on the Start Screen. This cannot be programmed any longer.

      Delete