UWF_Filter

統合書き込みフィルター (UWF) を有効または無効にし、UWF の構成設定をリセットして、デバイスをシャットダウンまたは再起動します。

構文

class UWF_Filter{
    [key]  string Id;
    [read] boolean CurrentEnabled;
    [read] boolean NextEnabled;
    UInt32 Enable();
    UInt32 Disable();
    UInt32 ResetSettings();
    UInt32 ShutdownSystem();
    UInt32 RestartSystem();
};

メンバー

次の表に、このクラスに属するメソッドとプロパティを示します。

メソッド

メソッド 説明
UWF_Filter.Enable 次回の再起動時に UWF を有効にします。
UWF_Filter.Disable 次回の再起動時に UWF を無効にします。
UWF_Filter.ResetSettings UWF 設定を、インストール時にキャプチャされた orig の状態に復元します。
UWF_Filter.ShutdownSystem オーバーレイがいっぱいになった場合でも、UWF によって保護されているシステムを安全にシャットダウンします。
UWF_Filter.RestartSystem オーバーレイがいっぱいになった場合でも、UWF によって保護されているシステムを安全に再起動します。

Properties

プロパティ データ型 修飾子 説明
Id string [key] 一意の ID。 これは常に UWF_Filter に設定されます
CurrentEnabled Boolean [read] 現在のセッションに対して UWF が有効かどうかを示します。
NextEnabled Boolean [read] 次の再起動後に UWF が有効になっているかどうかを示します。

注釈

UWF の構成設定を変更するには、管理者アカウントを使用する必要があります。 どの種類のアカウントを持つユーザーでも、現在の構成設定を読み取ることができます。

次の例は、PowerShell スクリプトで WMI プロバイダーを使用して UWF を有効または無効にする方法を示しています。

PowerShell スクリプトは、UWF を有効または無効にするのに役立つ 3 つの関数を作成します。 さらにそれは、各関数を使用する方法を示します。

1 つ目の関数である Disable-UWF は、UWF_Filter の WMI オブジェクトを取得し、Disable() メソッドを呼び出して、次のデバイスの再起動後に UWF を無効にします。

2 つ目の関数である Enable-UWF は、UWF_Filter の WMI オブジェクトを取得し、Enable() メソッドを呼び出して、次のデバイスの再起動後に UWF を有効にします。

3 番目の関数 Display-UWFState は、UWF_Filter オブジェクトのプロパティを調べ、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

必要条件

Windows エディション サポートされています
Windows ホーム いいえ
Windows Pro いいえ
Windows Enterprise はい
Windows Education はい
Windows IoT Enterprise はい