UWF_FilterUWF_Filter

啟用或停用整合寫入篩選器 (UWF)、 重設 UWF 的組態設定和關機或重新啟動您的裝置。Enables or disables Unified Write Filter (UWF), 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;
    UInt32 Enable();
    UInt32 Disable();
    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.EnableUWF_Filter.Enable

在下一步 重新啟動,可讓 UWF。Enables UWF on the next restart.

UWF_Filter.DisableUWF_Filter.Disable

在下一步 重新啟動,停用 UWF。Disables UWF on the next restart.

UWF_Filter.ResetSettingsUWF_Filter.ResetSettings

已擷取的原始狀態還原 UWF 設定安裝時間。Restores UWF settings to the original state that was captured at install time.

UWF_Filter.ShutdownSystemUWF_Filter.ShutdownSystem

即使覆疊是完整安全地關閉 UWF,所保護的系統。Safely shuts down a system protected by UWF, even if the overlay is full.

UWF_Filter.RestartSystemUWF_Filter.RestartSystem

安全系統重新啟動受 UWF,即使覆疊已滿。Safely restarts a system protected by UWF, even if the overlay is full.

屬性Properties

屬性Property 資料類型Data type 限定詞Qualifiers 描述Description

IdId

字串string

[key][key]

唯一的識別碼。A unique ID. 這一定會設定為UWF_FilterThis is always set to UWF_Filter.

CurrentEnabledCurrentEnabled

布林值Boolean

[讀取][read]

指出目前的工作階段是否已啟用 UWF。Indicates if UWF is enabled for the current session.

NextEnabledNextEnabled

布林值Boolean

[讀取][read]

表示在下一步 重新啟動之後是否已啟用 UWF。Indicates if UWF is enabled after the next restart.

備註Remarks

您必須使用系統管理員帳戶來進行 UWF 的組態設定的任何變更。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

下列範例示範如何啟用或停用 UWF PowerShell 指令碼中使用 WMI 提供者。The following example demonstrates how to enable or disable UWF by using the WMI provider in a PowerShell script.

PowerShell 指令碼會建立三個函數,可協助啟用或停用 UWF。The PowerShell script creates three functions to help enable or disable UWF. 然後,它會示範如何使用每個函式。It then demonstrates how to use each function.

第一個函式中, Disable-UWF,擷取 WMI 物件UWF_篩選,並呼叫Disable() 方法,以在下一個裝置開機後停用 UWF 重新啟動。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.

第二個函式中, Enable-UWF,擷取 WMI 物件UWF_篩選,並呼叫Enable() 方法,以啟用 UWF 之後的下一個裝置重新啟動。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.

第三個函式中, Display-UWFState,會檢查的屬性UWF_篩選物件,並印出目前的設定值UWF_篩選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";
    }
}

# 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

需求Requirements

Windows EditionWindows Edition 支援Supported
Windows 10 家用版Windows 10 Home No
Windows 10 專業人員Windows 10 Pro No
Windows 10 企業版Windows 10 Enterprise Yes
Windows 10 教育版Windows 10 Education Yes

整合寫入篩選器 WMI 提供者參考Unified Write Filter WMI provider reference

整合的寫入篩選器Unified Write Filter