UWF_OverlayConfig

显示和配置统一写入筛选器 (UWF) 覆盖的全局设置。 可以修改 UWF 覆盖的最大大小和类型。

语法

class UWF_OverlayConfig{
    [key, Read] boolean CurrentSession;
    [read] UInt32 Type;
    [read] SInt32 MaximumSize;

    UInt32 SetType(
        UInt32 type
    );
    UInt32 SetMaximumSize(
        UInt32 size
    );
};

成员

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

方法

方法 说明
UWF_OverlayConfig.SetMaximumSize 设置覆盖的最大缓存大小(以 MB 为单位)。
UWF_OverlayConfig.SetType 将 UWF 覆盖的类型设置为基于 RAM 或基于磁盘。

属性

属性 数据类型 限定符 说明
CurrentSession Boolean [key, read] 指示对象包含其设置的会话。
- 如果当前会话
- 为 True,则重启后开始的下一个会话为 False。
类型 UInt32 [read] 指示覆盖的类型。
- 0 表示基于 RAM 的覆盖,
- 1 表示基于磁盘的覆盖。
MaximumSize SInt32 [read] 指示覆盖的最大缓存大小(以 MB 为单位)。

注解

对覆盖配置所做的更改会在启用 UWF 的下一次重启时生效。

必须先在当前会话中禁用 UWF,然后才能更改 Type 或 MaximumSize 属性。

示例

下面的示例演示如何使用 PowerShell 脚本中的 Windows Management Instrumentation (WMI) 提供程序更改 UWF 中的覆盖的最大大小或存储类型。

PowerShell 脚本创建两个函数来修改覆盖配置。 然后演示如何使用这些函数。 第一个函数为 Set-OverlaySize,用于设置覆盖的最大大小。 第二个函数为 Set-OverlayType,用于将覆盖类型设置为基于 RAM 或基于磁盘。

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

# Define common parameters

$CommonParams = @{"namespace"=$NAMESPACE; "computer"=$COMPUTER}

function Set-OverlaySize([UInt32] $size) {

# This function sets the size of the overlay to which file and registry changes are redirected
# Changes take effect after the next restart

# $size is the maximum size in MB of the overlay

# Make sure that UWF is currently disabled

    $UWFFilter = Get-WmiObject -class UWF_Filter @commonParams

    if ($UWFFilter.CurrentEnabled -eq $false) {

# Get the configuration for the next session after a restart

        $nextConfig = Get-WMIObject -class UWF_OverlayConfig -Filter "CurrentSession = false" @CommonParams;

        if ($nextConfig) {

# Set the maximum size of the overlay

        $nextConfig.SetMaximumSize($size);
            write-host "Set overlay max size to $size MB."
        }
    } else {
        write-host "UWF must be disabled in the current session before you can change the overlay size."
    }
}

function Set-OverlayType([UInt32] $overlayType) {

# This function sets the type of the overlay to which file and registry changes are redirected
# Changes take effect after the next restart

# $overlayType is the type of storage that UWF uses to maintain the overlay. 0 = RAM-based; 1 = disk-based.

    $overlayTypeText = @("RAM-based", "disk-based")

# Make sure that the overlay type is a valid value

    if ($overlayType -eq 0 -or $overlayType -eq 1) {

# Make sure that UWF is currently disabled

        $UWFFilter = Get-WmiObject -class UWF_Filter @commonParams

        if ($UWFFilter.CurrentEnabled -eq $false) {

# Get the configuration for the next session after a restart

            $nextConfig = Get-WMIObject -class UWF_OverlayConfig -Filter "CurrentSession = false" @CommonParams;

            if ($nextConfig) {

# Set the type of the overlay

        $nextConfig.SetType($overlayType);
                write-host "Set overlay type to $overlayTypeText[$overlayType]."
            }
        } else {
            write-host "UWF must be disabled in the current session before you can change the overlay type."
        }
    } else {
        write-host "Invalid value for overlay type.  Valid values are 0 (RAM-based) or 1 (disk-based)."
    }
}

# The following sample commands demonstrate how to use the functions to change the overlay configuration

$RAMMode = 0
$DiskMode = 1

Set-OverlaySize 2048

Set-OverlayType $DiskMode

要求

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

统一写入筛选器 WMI 提供程序参考

统一写入筛选器