Automatically launch apps with Windows Embedded 8 Industry

9/16/2013

Microsoft

September 2013

Summary

Helps you understand how to enable, configure and disable Windows 8 Application Launcher and Shell Launcher on a device running Windows Embedded 8 Industry (Industry 8).

  • Enable Windows 8 Application Launcher.
  • Configure Windows 8 Application Launcher global settings.
  • Configure Windows 8 Application Launcher settings for a specific user or group.
  • Perform an action when the App exits.
  • Configure Shell Launcher.
  • Enable Shell Launcher.
  • Add Shell Launcher to an image.
  • Configure Shell Launcher for a specific user or group.
  • Perform an action when the shell exits.
  • Restore the default Windows shell.

Applies To

Windows Embedded 8 Industry (Industry 8)

Introduction

Windows Embedded 8 Industry (Industry 8) is a trusted platform for building differentiated, highly manageable industry devices. With Industry 8, enterprises can provide their customers with intuitive experiences and actionable intelligence and gain lasting competitive advantage with the powerful connectivity, enhanced security capabilities and seamless integration with Microsoft enterprise management tools that Industry 8 provides.

The ability to launch a line of business apps as soon as an embedded device starts or as soon as a user logs on is key to providing a consistent and predictable user experience. Industry 8 can be configured easily and quickly to launch either traditional Win32 desktop apps or the new Windows 8 apps automatically on startup. This document, intended for IT professionals, provides step-by-step guidance for this actin as well as extensive links for additional information.

Enterprises turn to Windows Embedded for devices that provide new and powerful customer experiences, harness the power of business intelligence and enable new mobility scenarios for task works by making the devices more portable and more connected. Encompassing operating systems, tools and other systems and services, Windows Embedded enables enterprises to generate tangible real-time benefits with anytime, anywhere access to executable data.

Windows Embedded 8 brings a set of new capabilities designed specifically for industry devices used to enhance customer experiences through user-friendly applications and immersive touch interactions. Windows Embedded 8 shortens development cycles and lets device makers create differentiated best-in-class products that delight customers and stand out from the competition. Enterprises benefit from new Windows Embedded 8 innovations in power management, enterprise integration, and connectivity support while relying on the trusted Microsoft technology platform. Devices built with is_we8 easily integrate into the existing enterprise IT ecosystem alongside Windows-based PCs and servers for seamless management by Microsoft enterprise management tools.

Windows Embedded 8 Industry (Industry 8) is a standardized solution designed for industries such as retail, manufacturing, healthcare, and financial services.

  • Multitouch, gesture input and Windows 8 apps help deliver immersive user experiences.
  • Advanced lockdown features maintain consistent and predictable user experiences.
  • Plug-and-play capabilities make it easier to use retail peripherals with desktop applications.
  • Connectivity to on-premises and cloud-based IT assets provide access to business-critical information at the point of impact.

A key feature for providing a consistent, predictable and differentiated user experience is the ability to launch a particular application as soon as the device starts or when a user logs on.

This guide, intended for IT professionals, system integrators (SIs), and independent software vendors (ISVs), describes how to easily and quickly configure Industry 8 to automatically launch either the new Windows 8 apps with the Windows 8 Application Launcher feature or to launch traditional Win32-style desktop apps with Shell Launcher.

See Windows Embedded for more information about Windows Embedded 8 and Industry 8.

Why Windows Embedded 8?

  • Create differentiated devices
    Assisted by the latest innovations from Microsoft, device makes can deliver a unique, branded experience throughout the device to define an exceptional user experience for their customers.
  • Build specialized devices on trusted technologies
    Windows Embedded 8 brings the latest security technologies from Windows 8 to help protect customers’ sensitive business information on specialized devices.
  • Extend business intelligence
    Microsoft delivers seamless enterprise identity and access management, devices can be managed efficiently alongside Windows PCs and connect to Windows Azure and Windows Server to help ensure that customers’ data translates into a unique competitive advantage.

Using the Windows 8 Application Launcher

You can use the Windows 8 Application Launcher feature to start a Windows 8 app immediately after a user signs into a Industry 8 device, and to restart the app when the app exits. You can also configure the Windows 8 Application Launcher to launch different apps for different users or user groups. This is especially useful for point-of-service (POS) devices and other specialized devices that require specific user types to log on and immediately be presented with the application that pertains to them.

The Windows 8 Application Launcher is written specifically to work with new Windows 8 apps; for traditional desktop (Win32) applications, we recommend you use the Shell Launcher described in a following section. You can configure the Windows 8 Application Launcher to perform a special action based on an exit value returned by the app. For example, you could configure the Windows 8 Application Launcher to log off or restart the device if the app exits. Again, this is useful for an embedded device to help ensure a consistent and predictable user experience.

Note that the Windows 8 Application Launcher runs on top of the Windows 8 explorer shell, so we recommend that you lock down any Windows 8 shell functionality that is not appropriate for your customized device. Industry 8 provides this capability with embedded lockdown features like the Embedded Lockdown Manager (ELM) and Gesture Filter to prevent user access to the charms bar and systems settings.

Note also that if a Windows 8 app closes itself, Windows treats that is a crash. If the Windows 8 app crashes, Industry 8 might display an error message on the screen. You can configure the Industry 8 to hide the error message and take action based on the error.

See WER Settings for more information on Windows Error Reporting (WER).

See Windows 8 Application Launcher Overview (Standard 8) for more information about the Windows 8 Application Launcher.

Before You Begin

Before you can configure the Windows 8 Application Launcher, you will need the following information:

  • The Application User Model ID (AppUserModelIDs or AUMID) of the Windows 8 app you want to launch.
  • The list of CustomExitCode values, if any, that the is_win8app can write to indicate an exit code status.

The Windows Management Instrumentation (WMI) provides three classes to help configure the Windows 8 Application Launcher:

  • WEMSAL_AppXInformation
    You can use this class to find the Application User Model ID (AUMID) of any installed Windows 8 app on the device and then use the AUMID to configure Windows 8 Application Launcher to launch the app.
    See WEMSAL_AppXInformation for more information on WEMSAL_AppXInformation.
  • WEMSAL_GlobalSetting
    You can use this class to configure the global settings for Windows 8 Application Launcher.
    See WEMSAL_GlobalSetting for more information on WEMSAL_GlobalSetting.
  • WEMSAL_UserSetting
    You can use this class to configure user-specific or group-specific settings for Windows 8 Application Launcher.
    See WEMSAL_UserSetting

Windows Embedded 8 Industry (Industry 8) features that work with Windows 8 apps use the AUMID to identify the app. The AUMID format is the package family name followed by an exclamation point and then the application ID. The application ID can be found in the AppManifest.xml file, under the <Applications> node.

To identify the AUMID of an installed app, type the following commands at a Windows PowerShell command prompt on your device:

$installedapps = get-AppxPackage

$aumidList = @()
foreach ($app in $installedapps)
{
    foreach ($id in (Get-AppxPackageManifest $app).package.applications.application.id)
    {
        $aumidList += $app.packagefamilyname + "!" + $id
    }
}

$aumidList

This will list the AUMIDs for all Windows 8 apps installed for the current user on your device.

You can add the –user <username> or the –allusers parameters to the get-AppxPackage cmdlet to list AUMID s for other users. You must use an elevated Windows PowerShell prompt to use the –user or –allusers parameters.

You can also identify the AUMID of an installed app for the current user by using the registry. Type the following on your device at a command prompt:

reg query HKEY_CURRENT_USER\Software\Classes\ActivatableClasses\Package /s /f AppUserModeID | find “REG_SZ”

See Application User Model IDs (AppUserModelIDs) and Guidelines for Developing Windows 8 Apps for Windows Embedded 8 Standard for more information on working with AUMIDs.

Note that the app must be installed on the device for the current user in order for the Windows 8 Application Launcher to launch the app. If the Windows 8 Application Launcher cannot find the app or if it cannot launch the app for any reason, the Windows 8 Application Launcher waits a very short period of time (approximately 100 milliseconds) and tries to relaunch the app. If the Windows 8 Application Launcher cannot launch the app after ten attempts, then the Windows 8 Application Launcher logs out the current user.

To modify this behavior, you can change the FatalErrorAction registry key. See Windows 8 Application Launcher Registry Keys for more information about this registry key.

Enable the Windows 8 Application Launcher

To enable the Windows 8 Application Launcher on Industry 8, modify the following registry key: HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

To simplify the process, create a file containing the following and save it to the root of your device's system drive as AppLauncher_Enable.reg:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"EmbeddedAppLauncher"="EmbeddedAppLauncher.exe"

To enable Windows 8 Application Launcher, open a command prompt with administrator privileges on you device and type the following to use the file you created to enable Windows 8 Application Launcher.

reg import %systemdrive%\AppLauncher_Enable.reg

The following regedit command can also be used to enable Windows 8 Application Launcher:

reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Run /v EmbeddedAppLauncher /d EmbeddedAppLauncher.exe

The following regedit command can be used to disable Windows 8 Application Launcher:

reg delete HKLM\Software\Microsoft\Windows\CurrentVersion\Run /v EmbeddedAppLauncher

Warning

Enabling the Windows 8 Application Launcher should be done after the new Windows 8 app has been installed and the global and user/group settings are set. This will avoid the user/group sessions automatically logging out because an app was not found.

Configure Global Settings

Return Code Action Settings

The following table contains the return code action settings:

Return code value Description

0

Restart the application

1

Restart the system

2

Shut down the system

3

Close the Windows 8 Application Launcher

4

Log off

Configure for a Specific User or Group

You can configure the Windows 8 Application Launcher to launch different Windows 8 apps for specific users or groups. For example, you might configure a device to launch one Windows 8 app for customer accounts, but launch a different Windows 8 app for employee accounts.

For each user or group account, you can configure the following:

  • The Windows 8 app to launch
  • The exit code mapping for specialized Windows 8 apps
  • The default exit action

Order for Determining Configuration

Windows 8 Application Launcher uses the following order to determine the configuration to use:

  1. Current user account configuration
    The Windows 8 Application Launcher uses the configuration for the current user account, if one exists. It does not matter if the current user is an administrator or not.
  2. Administrator account
    If no specific user configuration exists and the current user account is an administrator account, the Windows 8 Application Launcher exits without launching any app. If you want to launch an app for an administrator account, you must add a configuration for the specific user account that is a member of the administrator group.
  3. Group account configuration
    If a configuration exists for a group that the current user account is a member of, the Windows 8 Application Launcher uses the first matching configuration that it finds. The group account must not be a member of the administrator group or else the Windows 8 Application Launcher exits without launching any app.
    Note that the group account configuration order is not defined; for this reason, it is recommended that you avoid assigning a user to multiple groups with different Windows 8 Application Launcher configurations.

Perform an Action When the App Exits

When the launched app exits, Windows 8 Application Launcher can perform one of four app exit actions, based on the action exit values list above.

  • Default Exit Action
    You must define a default exit action for Windows 8 Application Launcher. If you do not change the initial value, the default exit action is set to 0 (zero), which indicates that Windows 8 Application Launcher restarts the app when the app exits.

  • Standard Windows 8 apps
    Windows 8 apps that are not specifically designed to work with Windows 8 Application Launcher, including Windows Store apps, do not return an exit code when the app exits. In these cases, Windows 8 Application Launcher performs the default exit action when it detects that the app has stopped running.

  • Specialized Windows 8 apps
    If you create a specialized Windows 8 app designed to work with Windows 8 Application Launcher, you can have the app write a CustomExitCode key before it exits. This integer key, is written to the app data local settings. If the app exits and Windows 8 Application Launcher detects a CustomExitCode key, Windows 8 Application Launcher can take specific action based on the value of the CustomExitCode.
    For any given CustomExitCode value returned by the app, you configure the action that Windows 8 Application Launcher takes by mapping that custom exit code to one of the app exit actions.

  • For example, your specialized Windows 8 app might return CustomExitCode values of 0, 1, or 255, depending on how the app exits. You can configure Windows 8 Application Launcher to restart the system (1) when the app returns a value of 0, restart the app (0) when the app returns a value of 1, and shut down the system (2) when the app returns a value of 255. Your custom return code action mapping would look like the values listed in the following table.

    CustomExitCode Action taken

    0

    1 (restart the system)

    1

    0 (restart the app)

    255

    2 (shut down the system)

    If Windows 8 Application Launcher cannot find a CustomExitCode, or can't find a mapping for the CustomExitCode value, Windows 8 Application Launcher performs the default exit action.

Example

For example, from a Windows PowerShell script with elevated privileges, you can use Set-ExecutionPolicy RemoteSigned:

#---Define variables---

$COMPUTER = "localhost"
$NAMESPACE = "root\standardcimv2\embedded"

# Define actions to take when the shell program exits

$ActionRestartApp = 0
$ActionRestartDevice = 1
$ActionShutdownDevice = 2
$ActionCloseMSAL = 3
$ActionLogoff = 4

#Define the Windows 8 app to launch. In this example, use the Application User Model ID (AUMID) for Internet Explorer 10.
#To use a different Windows 8 app, change $Win8AppAUMID to the AUMID of the Windows 8 app to launch.

$Win8AppAUMID = "DefaultBrowser_NOPUBLISHERID!Microsoft.InternetExplorer.Default"

#Define the default action for Windows 8 Application Launcher to take when the app exits.

$AppExitAction = $ActionRestartApp

#Check to see if a global configuration already exists and, if so, update it.

$GlobalConfig = get-WMIObject –namespace $NAMESPACE –computer $COMPUTER –class WEMSAL_GlobalSetting

if ($GlobalConfig) {
   # Configuration already exists. Update it.

   $GlobalConfig.AppUserModelID = $Win8AppAUMID;
   $GlobalConfig.DefaultReturnCodeAction = $AppExitAction;
   $GlobalConfig.Put() | Out-Null;

   "Updated global settings for Windows 8 Application Launcher."
   "   AUMID = " + $GlobalConfig.AppUserModelId
   "   App exit action = " + $GlobalConfig.DefaultReturnCodeAction

} else {

   #Create a new configuration for the user to launch IE10 and restart the app if it exits.

   Set-WmiInstance –class WEMSAL_GlobalSetting –ComputerName $COMPUTER –Namespace $NAMESPACE –Argument @{
      InstanceName = "WEMSAL_GlobalSetting";
      AppUserModelId = $Win8AppAUMID;
      DefaultReturnCodeAction = $AppExitAction } | Out-Null;

   # Confirm that the settings were created properly

   $GlobalConfig = get-WmiObject –namespace $NAMESPACE –computer $COMPUTER –class WEMSAL_GlobalSetting

   if ($GlobalConfig) {
      "Created global settings for Windows 8 Application Launcher."
      "   AUMID = " + $GlobalConfig.AppUserModelId
      "   App exit action = " + $GlobalConfig.DefaultReturnCodeAction

   } else {

      "Could not create global settings for Windows 8 Application Launcher."
   }
}

Using Shell Launcher

Windows Embedded 8 Industry (Industry 8) uses Windows Explorer (Explorer.exe) as the default shell. However, you can use Shell Launcher to create a custom shell, replacing the default Windows 8 shell with any traditional desktop application or executable.

Note that you cannot use Shell Launcher to launch a Windows 8 app as a custom shell. Use the Windows 8 Application Launcher to launch Windows 8 apps at startup, as described in the previous section, Using the Windows 8 Application Launcher.

Note also that you can specify any executable file to be the default shell except C:\Windows\System32\eshell.exe. Using eshell.exe as the default shell will result in a blank screen after user logon.

Shell Launcher processes the Run and RunOnce registry keys before starting the custom shell, so your custom shell does not need to handle the automatic startup of other applications and services. You can use Shell Launcher to specify how the system will behave when your custom shell exits. In addition, you can configure Shell Launcher to start different shell applications for different users or user groups.

A custom shell is launched with the same level of privileges as the logged-on user. This means that a user with administrator privileges can perform any system action that requires administrator privileges, including launching other applications with administrator privileges, while a user without administrator access cannot. If your shell application requires administrator privileges and needs to be elevated and User Account Control (UAC) is present on your device, you must disable UAC in order for Shell Launcher to launch the shell application.

See Shell Launcher and Shell Launcher Overview for more information.

Configure Shell Launcher

You can configure Shell Launcher at design time or run time. All configuration settings for Shell Launcher are stored in the registry and configuration changes take effect immediately if Shell Launcher is enabled. You can configure the following options:

  • Specify a shell configuration for a specific user or group.
  • Remove a shell configuration for a specific user or group.
  • Change the default shell configuration.
  • Get information on a shell configuration for a specific user or group.

Configure Shell Launcher at Run Time

You can use the Shell Launcher WMI providers directly in a Windows PowerShell script or in an application to configure Shell Launcher at run time. You can also use Embedded Lockdown Manager (ELM), included with Windows Embedded 8, to configure Shell Launcher. ELM enables IT pros and operating system developers to gain quick access to embedded lockdown features on the target device for rapid prototyping to help ensure a consistent and predictable user experience. After you have your desired lockdown configuration with ELM, it can be exported to a Windows PowerShell script and incorporated into the task sequencing with System Center 2012 Configuration Manager to further aid automated deployment of lockdown scenarios to multiple devices. The following screenshot shows the configuration of Shell Launcher to launch the standard explorer.exe shell for administrators and cmd.exe for a user.

ELM with Shell Launcher

See Shell Launcher WMI Provider Reference for more information about Shell Launcher WMI Providers.

See Embedded Lockdown Manager (ELM) Technical Reference for more information about ELM

Enable Shell Launcher

To enable Shell Launcher on Industry 8, modify the following registry key: HKLM\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon\Shell.

To simplify the process, create a file containing the following and save it to the root of your device's system drive as Shell_eShell.reg:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon]
"Shell"="eShell.exe"

Note that if your shell does not have a way to start Reg.exe or Regedit.exe so that you can restore the changes to the default Windows, you might have to modify the registry offline or reinstall if you are not familiar with offline registry editing.

Before you begin to change the system registry, note your Administrator account name and make sure that it has a password. You cannot reverse the changes you are about to make unless your Administrator account has a password. The only way to recover is to modify the registry offline or reinstall.

Note also that before you enable Shell Launcher, we strongly recommended that you configure the appropriate default behavior of Shell Launcher for all accounts.

To enable Shell Launcher, open a command prompt with administrator privileges on your device and type:

reg import %systemdrive%\Shell_eShell.reg

Add the Shell Launcher to your Image

Shell Launcher is included in the Windows Embedded 8 Industry (Industry 8) image but might or might not be included in a Windows Embedded 8 Standard (Standard 8) image, depending on how the image was created. Contact the original equipment manufacturer (OEM) providing the device for information about adding Shell Launcher to the device image.

Configure for a Specific User or Group

By default, Shell Launcher runs the default shell, which is specified when you create the operating system image at the time of design. The default shell is set to CMD.EXE but you can specify other executable files to be the default shell.

You can configure Shell Launcher to launch a different shell for specific users or groups if you do not want to run the default shell. For example, you might configure a device to run a custom application shell for guest accounts, but run the standard Windows Explorer shell for administrator accounts in order to be able to service the device.

If you use the WMI providers to configure Shell Launcher for a user or group at run time, you must use the security identifier (SID) for that user or group; you cannot use the user name or group name. If you use the Embedded Lockdown Manager (ELM) to configure Shell Launcher, ELM converts user and group names to their SID value.

See Well-known SIDs for more information about common security identifiers.

When the current logon account belongs to two or more groups that have different configurations defined for each group, Shell Launcher uses the first configuration it finds. The search order is not defined, so we recommend that you avoid assigning a user to multiple groups with different Shell Launcher configurations.

Perform an Action When the Shell Exits

When a custom shell exits, Shell Launcher can perform one of four actions, based on the following return codes.

Return code value Description

0

Restart the shell

1

Restart the device

2

Shut down the device

3

Do nothing

Make sure that your shell application does not automatically exit and is not automatically closed by any features such as Dialog Filter, because this can lead to an infinite cycle of exiting and restarting, unless the return code action is set to do nothing.

Default Return Code Action

You can define a default return action for Shell Launcher with the DefaultReturnCodeAction setting. If you do not change the initial value, the default return code action is set to 0 (zero), which indicates that Shell Launcher restarts the shell when the shell exits.

Map the Exit Code to an Action

Shell Launcher can take a specific action based on the exit code returned by the shell. For any given exit code returned by the shell, you can configure the action that Shell Launcher takes by mapping that exit code to one of the shell exit actions.

If the exit code does not match a defined value, Shell Launcher performs the default return code action.

For example, your shell might return exit code values of -1, 0, or 255 depending on how the shell exits. You can configure Shell Launcher to:

  • Restart the system (1) when the shell returns a value of -1
  • Restart the shell (0) when the shell returns a value of 0
  • Shut down the system (2) when the shell returns a value of 255

Your custom return code action mapping would look like that listed in the following table.

Exit code Action taken

-1

1 (Restart the system)

0

0 (Restart the shell)

255

2 (Shut down the system)

See SetCustomShell for more information.

Restore the Default Windows Shell

To restore the default Windows Shell, perform the following steps:

  1. At a command prompt, type Regedit and answer Yes in the User Account Control dialog box.

  2. On the File menu, click Import…, select Shell_Explorer.reg from the root of your system drive then click Open and click OK on the confirmation dialog.

  3. Restart your device.

When your device restarts, the shell will be the default Windows shell.

Conclusion

Windows Embedded 8 Industry (Industry 8) makes it possible to launch directly into new, rich, immersive Windows Embedded 8 or desktop line-of-business applications, providing a consistent and differentiated device user experience.

For Windows 8 applications, Industry 8 lets you:

  • Deliver fast, fluid application experiences by building Windows 8 apps applications.
  • Realize the benefits of cross-platform application development by extending usability of your applications.
  • Use common APIs for embedded applications.
  • Bring your users interactive and rich user experiences using XAML or HTML5.
  • Build apps using the proven Windows (both native and managed) application models that drive business today.
  • Preserve your investment in today's applications with Windows 7 compatibility.

The ability to launch apps during startup is one of the many features and benefits provided by Windows Embedded 8 Industry (Industry 8).

Additional Information

See Windows Embedded for more information about Windows Embedded versions and capabilities.

See Windows Embedded Developer Update for more information about the Windows Embedded Developer Update (WEDU) application.

See Windows Embedded Device Management for more information about managing and configuring embedded devices.

See POS for .NET for more information on POS for .NET v1.12 SDK, which includes interfaces for applications to interact with POS devices.

See Shell Launcher Overview (Standard 8) for more information on Shell Launcher. You can use Shell Launcher to replace the default Windows 8 shell with a custom shell. You can use any application or executable as your custom shell, such as a command windows or a custom application.

See Windows 8 Application Launcher Overview (Standard 8) for more information on Windows 8 Application Launcher. You can use Windows 8 Application Launcher to start a Windows 8 immediately after a user signs into a Windows Embedded 8 device and to restart the app when the app exits. You can configure Windows 8 Application Launcher to launch different apps for different users.