UWF_Filter

Mengaktifkan atau menonaktifkan Filter Tulis Terpadu (UWF), mengatur ulang pengaturan konfigurasi untuk UWF, dan mematikan atau memulai ulang perangkat Anda.

Sintaks

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

Anggota

Tabel berikut mencantumkan metode dan properti apa pun yang termasuk dalam kelas ini.

Metode

Metode Deskripsi
UWF_Filter.Enable Mengaktifkan UWF pada mulai ulang berikutnya.
UWF_Filter.Disable Menonaktifkan UWF pada mulai ulang berikutnya.
UWF_Filter.ResetSettings Memulihkan pengaturan UWF ke status inal orig yang diambil pada waktu penginstalan.
UWF_Filter.ShutdownSystem Mematikan sistem yang dilindungi oleh UWF dengan aman, bahkan jika overlay penuh.
UWF_Filter.RestartSystem Menghidupkan ulang sistem yang dilindungi oleh UWF dengan aman, bahkan jika overlay penuh.

Properti

Properti Jenis Data Kualifikasi Deskripsi
Id string [kunci] ID unik. Ini selalu diatur ke UWF_Filter
CurrentEnabled Boolean [baca] Menunjukkan apakah UWF diaktifkan untuk sesi saat ini.
NextEnabled Boolean [baca] Menunjukkan apakah UWF diaktifkan setelah hidupkan ulang berikutnya.

Keterangan

Anda harus menggunakan akun administrator untuk membuat perubahan apa pun pada pengaturan konfigurasi untuk UWF. Pengguna dengan segala jenis akun dapat membaca pengaturan konfigurasi saat ini.

Contoh

Contoh berikut menunjukkan cara mengaktifkan atau menonaktifkan UWF dengan menggunakan penyedia WMI dalam skrip PowerShell.

Skrip PowerShell membuat tiga fungsi untuk membantu mengaktifkan atau menonaktifkan UWF. Kemudian menunjukkan cara menggunakan setiap fungsi.

Fungsi pertama, Disable-UWF, mengambil objek WMI untuk UWF_Filter, dan memanggil metode Disable() untuk menonaktifkan UWF setelah perangkat berikutnya dimulai ulang.

Fungsi kedua, Enable-UWF, mengambil objek WMI untuk UWF_Filter, dan memanggil metode Enable() untuk mengaktifkan UWF setelah perangkat berikutnya dimulai ulang.

Fungsi ketiga, Display-UWFState, memeriksa properti objek UWF_Filter , dan mencetak pengaturan saat ini untuk 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

Persyaratan

Edisi Windows Didukung
Windows Home Tidak
Windows Pro Tidak
Windows Enterprise Ya
Windows Education Ya
Windows IoT Enterprise Ya