Share via


WEMSAL_UserAppXInformation (Industry 8.1)

7/8/2014

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

This Windows Management Instrumentation (WMI) provider class contains information about all Windows Store apps installed on a device. You can use this class to find the friendly display name of any installed Windows Store app on the device, in addition to which users have installed that app.

Warning

To add this WMI provider to your device, you must download and apply the Update for Windows Embedded Industry 8.1 (KB2932074) from the Microsoft Download Center.

Syntax

class WEMSAL_UserAppXInformation {
    [read, key] string AppUserModelId;
    [read] string AppDisplayName;
    [read] string UserSids[];
};

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

AppUserModelId

string

[read, key]

Indicates the Application User Model ID (AUMID) of the Windows Store app package.

AppDisplayName

string

[read]

Indicates the friendly display name of the installed app.

UserSids

String []

[read]

Indicates an array of user security IDs (SIDs) that have installed the app.

Remarks

You must use an administrator account to access this class.

This class does not return information about default web browsers that are installed on the device.

The AppDisplayName is displayed in the first language that can be found on the device from the following list, in order:

  1. English (en-US)
  2. The closest English match to en-US, for example, en-GB or en-IN.
  3. The app default language if no English strings are present in the app’s primary resource file.
  4. The thread preferred UI language, which is one of the installed languages on the system. For more information, see User Interface Language Management on MSDN.
  5. The display name as it appears in the app manifest file.

If WEMSAL_UserAppXInformation cannot find the display name in the app manifest file, the AppDisplayName is set to the AUMID of the app.

Example

The following sample Windows PowerShell script uses this class to list all Windows Store apps installed for each account on the device.

# Define common parameters.

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

$CommonParams = @{"namespace"=$NAMESPACE; "computer"=$COMPUTER}

# Create a function to retrieve the user account name from the User Security ID (SID).
# This function does not check to verify that the user account actually exists.

function Get-AccountNameFromSID($UserSID) {

    $objSID = New-Object System.Security.Principal.SecurityIdentifier($UserSID) 
    $UserAccount = $objSID.Translate( [System.Security.Principal.NTAccount])

    return $UserAccount.Value
}

# Retrieve information about all Windows Store apps that are installed on the device for all users

$allUserApps = get-wmiobject –class WEMSAL_UserAppXInformation @CommonParams

# The WMI provider uses the AppUserModelId as the primary key.
# For this example, because we want to display all the apps installed for each user, we need to 
# create a hash table that uses the user SID as the primary key.

$userAppHashTable = @{}

foreach($appInfo in $allUserApps) {

    foreach($userSid in $appInfo.UserSids) {

        # Check to see if the user SID is already in the hash table.
        # We check this because if we are creating a new hash table
        # entry, we need to make sure that the value field is created
        # as an array, not as a string.

        if ($userAppHashTable[$userSid].count -eq 0) {
            $userAppHashTable[$userSid] = @($appInfo.AppDisplayName)
        } else {
            $userAppHashTable[$userSid] += $appInfo.AppDisplayName
        }
    }
}

# Display all Windows Store apps installed for each account.

foreach ($key in $userAppHashTable.keys) {

    # Get the account name from the SID and then display the account name.
    $accountName = Get-AccountNameFromSID($key);
    "`n Account " + $accountName + " has the following Windows Store apps installed:";

    # List the Windows Store apps that are installed for that account.
    foreach ($value in $userAppHashTable[$key]) {" - " + $value}

}

See Also

Concepts

Lockdown features