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,才能變更 TypeMaximumSize 屬性。

範例

下列範例示範如何使用 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 首頁 No
Windows 專業版
Windows 企業版
Windows 教育版
Windows IoT 企業版 是的

整合寫入篩選器 WMI 提供者參考資料

統一寫入篩選器