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();
};
Members
次の表に、このクラスに属するすべてのメソッドとプロパティを示します。
メソッド
メソッド | 説明 |
---|---|
UWF_Filter.Enable | 次回の再起動時に UWF を有効にします。 |
UWF_Filter.Disable | 次回の再起動時に UWF を無効にします。 |
UWF_Filter.ResetSettings | インストール時にキャプチャされた元の状態に UWF 設定を復元します。 |
UWF_Filter.ShutdownSystem | オーバーレイがいっぱいであっても、UWF によって保護されたシステムを安全にシャットダウンします。 |
UWF_Filter.RestartSystem | オーバーレイがいっぱいであっても、UWF によって保護されたシステムを安全に再起動します。 |
プロパティ
プロパティ | データ型 | 修飾子 | 説明 |
---|---|---|---|
Id | 文字列 | [キー] | 一意の ID。 これは常に UWF_Filter に設定されます |
CurrentEnabled | ブール値 | [read] | 現在のセッションで UWF が有効かどうかを示します。 |
NextEnabled | ブール値 | [read] | 次の再起動後に UWF が有効かどうかを示します。 |
注釈
UWF の構成設定を変更するには、管理者アカウントを使用する必要があります。 任意の種類のアカウントを持つユーザーは、現在の構成設定を読み取ることができます。
例
次の例では、PowerShell スクリプトで WMI プロバイダーを使用して UWF を有効または無効にする方法を示します。
PowerShell スクリプトは、UWF を有効または無効にするために役立つ 3 つの関数を作成します。 次に、各関数の使用方法を示します。
最初の関数 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 | 要 |