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 | 设置覆盖的最大缓存大小(以兆字节为单位)。 |
UWF_OverlayConfig.SetType | 将 UWF 覆盖的类型设置为基于 RAM 或基于磁盘。 |
属性
属性 | 数据类型 | 限定 符 | 描述 |
---|---|---|---|
CurrentSession | 布尔 | [key,read] | 指示对象包含其设置的会话。
- 对于重启后开始的下一个会话,当前会话 - 为 True False。 |
类型 | UInt32 | [read] | 指示覆盖的类型。
- 0 表示基于 RAM 的覆盖, - 1 表示基于磁盘的覆盖。 |
MaximumSize | SInt32 | [read] | 指示覆盖层的最大缓存大小(以兆字节为单位)。 |
备注
对覆盖配置的更改在启用 UWF 的下次重启时生效。
在更改 Type 或 MaximumSize 属性之前,必须在当前会话中禁用 UWF。
示例
以下示例演示如何在 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 企业版 | 是 |