UWF_Overlay

包含统一写入筛选器 (UWF) 覆盖的当前大小,并管理覆盖大小的关键阈值和警告阈值。

语法

class UWF_Overlay {
    [key]  string Id;
    [read] UInt32 OverlayConsumption;
    [read] UInt32 AvailableSpace;
    [read] UInt32 CriticalOverlayThreshold;
    [read] UInt32 WarningOverlayThreshold;

    UInt32 GetOverlayFiles(
        [in] string Volume,
        [out, EmbeddedInstance("UWF_OverlayFile")] string OverlayFiles[]
    );
    UInt32 SetWarningThreshold(
        UInt32 size
    );
    UInt32 SetCriticalThreshold(
        UInt32 size
    );
};

成员

下表列出了属于此类的任何方法和属性。

方法 说明
UWF_Overlay.GetOverlayFiles 返回在 UWF 覆盖中缓存的卷的文件列表。
UWF_Overlay.SetWarningThreshold 设置用于监视 UWF 覆盖大小的警告阈值。
UWF_Overlay.SetCriticalThreshold 设置用于监视 UWF 覆盖大小的严重警告阈值。

属性

属性 数据类型 限定符 说明
ID 字符串 [key] 唯一 ID。 这始终设置为 UWF_Overlay。
OverlayConsumption UInt32 [read] UWF 覆盖的当前大小(以 MB 为单位)。
AvailableSpace UInt32 [read] 可用于 UWF 覆盖的可用空间量(以 MB 为单位)。
CriticalOverlayThreshold UInt32 [read] 关键阈值大小(以 MB 为单位)。 当 UWF 覆盖大小达到或超过此值时,UWF 将发送关键阈值通知事件。
WarningOverlayThreshold UInt32 [read] 警告阈值大小(以 MB 为单位)。 当 UWF 覆盖大小达到或超过此值时,UWF 将发送警告阈值通知事件。

示例

以下示例演示如何通过在 PowerShell 脚本中使用 WMI 提供程序来使用 UWF 覆盖。

$COMPUTER = "localhost"
$NAMESPACE = "root\standardcimv2\embedded"

# Function to set the Unified Write Filter overlay warning threshold

function Set-OverlayWarningThreshold($ThresholdSize) {

# Retrieve the overlay WMI object

    $OverlayInstance = Get-WMIObject -namespace $NAMESPACE -class UWF_Overlay;

    if(!$OverlayInstance) {
        "Unable to get handle to an instance of the UWF_Overlay class"
        return;
    }

# Call the instance method to set the warning threshold value

    $retval = $OverlayInstance.SetWarningThreshold($ThresholdSize);

# Check the return value to verify that setting the warning threshold is successful

    if ($retval.ReturnValue -eq 0) {
        "Overlay warning threshold has been set to " + $ThresholdSize + " MB"
    } else {
        "Unknown Error: " + "{0:x0}" -f $retval.ReturnValue
    }
}

# Function to set the Unified Write Filter overlay critical threshold

function Set-OverlayCriticalThreshold($ThresholdSize) {

# Retrieve the overlay WMI object

    $OverlayInstance = Get-WMIObject -namespace $NAMESPACE -class UWF_Overlay;

    if(!$OverlayInstance) {
        "Unable to get handle to an instance of the UWF_Overlay class"
        return;
    }

# Call the instance method to set the warning threshold value

    $retval = $OverlayInstance.SetCriticalThreshold($ThresholdSize);

# Check the return value to verify that setting the critical threshold is successful

    if ($retval.ReturnValue -eq 0) {
        "Overlay critical threshold has been set to " + $ThresholdSize + " MB"
    } else {
        "Unknown Error: " + "{0:x0}" -f $retval.ReturnValue
    }
}

# Function to print the current overlay information

function Get-OverlayInformation() {

# Retrieve the Overlay WMI object

    $OverlayInstance = Get-WMIObject -namespace $NAMESPACE -class UWF_Overlay;

    if(!$OverlayInstance) {
        "Unable to get handle to an instance of the UWF_Overlay class"
        return;
    }

# Display the current values of the overlay properties

    "`nOverlay Consumption: " + $OverlayInstance.OverlayConsumption
    "Available Space: " + $OverlayInstance.AvailableSpace
    "Critical Overlay Threshold: " + $OverlayInstance.CriticalOverlayThreshold
    "Warning Overlay Threshold: " + $OverlayInstance.WarningOverlayThreshold
}

# Examples of using these functions

"`nSetting the warning threshold to 768 MB."
Set-OverlayWarningThreshold( 768 )

"`nSetting the critical threshold to 896 MB."
Set-OverlayCriticalThreshold( 896 )

"`nDisplaying the current state of the overlay."
Get-OverlayInformation

注解

对于使用 UWF 保护的系统,只存在一个 UFW_Overlay 实例。

要求

Windows 版本 支持
Windows 主页
Windows 专业版
Windows 企业版
Windows 教育版
Windows IoT 企业版 是的