Share via


UWF_Filter (Industry 8.1)

7/8/2014

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

This Windows Management Instrumentation (WMI) class enables or disables Unified Write Filter (UWF) and Hibernate Once/Resume Many (HORM) functionality, resets configuration settings for UWF, and shuts down or restarts your device.

Syntax

class UWF_Filter{
    [key]  string Id;
    [read] boolean CurrentEnabled;
    [read] boolean NextEnabled;
    [read] boolean HORMEnabled;

    UInt32 Enable();
    UInt32 Disable();
    UInt32 EnableHORM();
    UInt32 DisableHORM();
    UInt32 ResetSettings();
    UInt32 ShutdownSystem();
    UInt32 RestartSystem();
};

Members

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

Methods

Methods

Description

UWF_Filter.Enable

Enables UWF on the next restart.

UWF_Filter.Disable

Disables UWF on the next restart.

UWF_Filter.EnableHORM

Enables Hibernate Once/Resume Many (HORM) on the next restart.

UWF_Filter.DisableHORM

Disables HORM on the next restart.

UWF_Filter.ResetSettings

Restores UWF settings to the original state that was captured at install time.

UWF_Filter.ShutdownSystem

Safely shuts down a system protected by UWF, even if the overlay is full.

UWF_Filter.RestartSystem

Safely restarts a system protected by UWF, even if the overlay is full.

Properties

Property

Data type

Qualifiers

Description

Id

string

[key]

A unique ID. This is always set to UWF_Filter.

CurrentEnabled

Boolean

[read]

Indicates if UWF is enabled for the current session.

NextEnabled

Boolean

[read]

Indicates if UWF is enabled after the next restart.

HORMEnabled

Boolean

[read]

Indicates if Hibernate Once/Resume Many (HORM) is enabled for the current session.

Remarks

You must use an administrator account to make any changes to the configuration settings for UWF. Users with any kind of account can read the current configuration settings.

Example

The following example demonstrates how to enable or disable UWF by using the WMI provider in a Windows PowerShell script.

The Windows PowerShell script creates three functions to help enable or disable UWF. It then demonstrates how to use each function.

The first function, Disable-UWF, retrieves a WMI object for UWF_Filter, and calls the Disable() method to disable UWF after the next device restart.

The second function, Enable-UWF, retrieves a WMI object for UWF_Filter, and calls the Enable() method to enable UWF after the next device restart.

The third function, Display-UWFState, examines the properties of the UWF_Filter object, and prints out the current settings for UWF_Filter.

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

# Create a function to disable the Unified Write Filter driver after the next restart.
function Disable-UWF() {

    # Retrieve the UWF_Filter settings.
    $objUWFInstance = Get-WMIObject -namespace $NAMESPACE -class UWF_Filter;

    if(!$objUWFInstance) {
        "Unable to retrieve Unified Write Filter settings."
        return;
    }
                    
    # Call the method to disable UWF after the next restart.  This sets the NextEnabled property to false.

    $retval = $objUWFInstance.Disable();

    # Check the return value to verify that the disable is successful
    if ($retval.ReturnValue -eq 0) {
        "Unified Write Filter will be disabled after the next system restart."
    } else {
        "Unknown Error: " + "{0:x0}" -f $retval.ReturnValue
    }
}

# Create a function to enable the Unified Write Filter driver after the next restart.
function Enable-UWF() {

    # Retrieve the UWF_Filter settings.
    $objUWFInstance = Get-WMIObject -namespace $NAMESPACE -class UWF_Filter;

    if(!$objUWFInstance) {
        "Unable to retrieve Unified Write Filter settings."
    return;
    }
                    
    # Call the method to enable UWF after the next restart.  This sets the NextEnabled property to false.

    $retval = $objUWFInstance.Enable();
        
    # Check the return value to verify that the enable is successful
    if ($retval.ReturnValue -eq 0) {
        "Unified Write Filter will be enabled after the next system restart."
    } else {
        "Unknown Error: " + "{0:x0}" -f $retval.ReturnValue
    }
}

# Create a function to display the current settings of the Unified Write Filter driver.
function Display-UWFState() {
    
    # Retrieve the UWF_Filter object
    $objUWFInstance = Get-WmiObject -Namespace $NAMESPACE -Class UWF_Filter;

    if(!$objUWFInstance) {
        "Unable to retrieve Unified Write Filter settings."
        return;
    }
    
    # Check the CurrentEnabled property to see if UWF is enabled in the current session.
    if($objUWFInstance.CurrentEnabled) {
        $CurrentStatus = "enabled";
    } else {
        $CurrentStatus = "disabled";
    }

    # Check the NextEnabled property to see if UWF is enabled or disabled after the next system restart.
    if($objUWFInstance.NextEnabled) {
        $NextStatus = "enabled";
    } else {
        $NextStatus = "disabled";
    }

    # Check the HORMEnabled property to see if Hibernate Once/Resume Many (HORM) is enabled for the current session.
    if($objUWFInstance.HORMEnabled) {
        $HORMStatus = "enabled";
    } else {
        $HORMStatus = "disabled";
    }

    # Display the state of the filter
    "`n"
    "`tThe Unified Write Filter is currently ${CurrentStatus}.";
    "`tThe Unified Write Filter will be ${NextStatus} after the next restart.";
    "`tHibernate Once/Resume Many functionality is ${HORMStatus}.";
    "`n";
}

# Some examples of how to call the functions

Display-UWFState

"Enabling Unified Write Filter"
Enable-UWF

Display-UWFState

"Disabling Unified Write Filter"
Disable-UWF

Display-UWFState

See Also

Reference

Unified Write Filter WMI provider reference

Concepts

Unified Write Filter