Поделиться через


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();
};

Участники

В следующих таблицах перечислены все методы и свойства, принадлежащие этому классу.

Методы

Методы Description
UWF_Filter.Enable Включает UWF в следующем перезапуске.
UWF_Filter.Disable Отключает UWF в следующем перезапуске.
UWF_Filter.Reset Параметры Восстанавливает параметры UWF в состоянии орига, которое было записано во время установки.
UWF_Filter.ShutdownSystem Сейф полностью завершает работу системы, защищенной UWF, даже если наложение заполнено.
UWF_Filter.RestartSystem Сейф перезагрузит систему, защищенную UWF, даже если наложение заполнено.

Свойства

Свойство Тип данных Квалификаторы Description
Id строка [ключ] Уникальный идентификатор. Для этого всегда задано значение UWF_Filter
CurrentEnabled Логический [чтение] Указывает, включена ли UWF для текущего сеанса.
NextEnabled Логический [чтение] Указывает, включена ли UWF после следующего перезапуска.

Замечания

Для внесения изменений в параметры конфигурации для UWF необходимо использовать учетную запись администратора. Пользователи с любой учетной записью могут считывать текущие параметры конфигурации.

Пример

В следующем примере показано, как включить или отключить UWF с помощью поставщика WMI в скрипте PowerShell.

Скрипт PowerShell создает три функции, которые помогут включить или отключить UWF. Затем показано, как использовать каждую функцию.

Первая функция, Disable-UWFизвлекает объект WMI для UWF_Filter и вызывает метод Disable(), чтобы отключить UWF после следующего перезапуска устройства.

Вторая функция, Enable-UWFизвлекает объект WMI для UWF_Filter и вызывает метод Enable(), чтобы включить UWF после следующего перезапуска устройства.

Третья функция, 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 Домашняя No
Windows Pro No
Windows Корпоративная Да
Windows для образовательных учреждений Да
Windows IoT Корпоративная Да