Condividi tramite


WEMSAL_GlobalSetting (Industry 8.1)

7/8/2014

Review the syntax, members, and examples of the WEMSAL_GlobalSetting WMI provider class for Windows Embedded 8.1 Industry (Industry 8.1).

This Windows Management Instrumentation (WMI) provider class configures the global settings for Windows 8 Application Launcher.

Syntax

class WEMSAL_GlobalSetting {
    [read, key, Required] string InstanceName;
    [read, write, Required] string AppUserModelId;
    [read, write] sint32 CustomReturnCodes[];
    [read, write] sint32 CustomReturnCodesAction[];
    [read, write, Required] sint32 DefaultReturnCodeAction;
};

Members

The following tables list any methods and properties that belong to this class.

Methods

This class contains no methods.

Properties

Property

Data type

Qualifiers

Description

InstanceName

string

[read, key, required]

A unique ID. This is always set to WEMSAL_GlobalSetting.

AppUserModelId

string

[read, write, required]

The Application User Model ID (AUMID) of the Windows Store app to launch.

CustomReturnCodes

sint32 []

[read, write]

An array of return codes that the launched app can write to the CustomExitCode local application data setting.

CustomReturnCodesAction

sint32 []

[read, write]

An array of custom return code actions that determine what action Windows 8 Application Launcher takes when the launched app exits. The custom actions map to the array of CustomReturnCodes.

The possible actions are defined in the following table:

ValueDescription
0Restart the application.
1Restart the device.
2Shut down the device.
3Close Windows 8 Application Launcher. This value is not valid if KioskMode is set to true in WEMSAL_Setting.
4Sign out the current user.

DefaultReturnCodeAction

sint32

[read, write, required]

The default action that Windows 8 Application Launcher takes when the launched app exits without writing a CustomExitCode that maps to a corresponding CustomReturnCodesAction.

The possible actions are defined in the following table:

ValueDescription
0Restart the application.
1Restart the device.
2Shut down the device.
3Close Windows 8 Application Launcher. This value is not valid if KioskMode is set to true in WEMSAL_Setting.
4Sign out the current user.

Remarks

You must use an administrator account to change any properties in this class.

The Windows Store app must be installed for the current user in order for Windows 8 Application Launcher to launch the app.

Only Windows Store apps that are specially designed to work with Windows 8 Application Launcher write the CustomExitCode value.

Example

The following Windows PowerShell script demonstrates how to use this class to add or update the default global settings for Windows 8 Application Launcher. This example configures Windows 8 Application Launcher to launch Internet Explorer 10 and restart the app when the app exits.

#---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 Internet Explorer 10, 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."
    }
}

See Also

Concepts

Windows 8 Application Launcher WMI provider reference
Windows 8 Application Launcher
Guidelines for developing Windows Store apps for Windows Embedded