Condividi tramite


UWF_OverlayConfig

Visualizza e configura le impostazioni globali per la sovrimpressione UWF (Unified Write Filter). È possibile modificare le dimensioni massime e il tipo di sovrimpressione UWF.

Sintassi

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

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

Membri

Nelle tabelle seguenti sono elencati i metodi e le proprietà che appartengono a questa classe.

Metodi

metodo Descrizione
UWF_OverlayConfig.SetMaximumSize Imposta le dimensioni massime della cache, in megabyte, della sovrimpressione.
UWF_OverlayConfig.SetType Imposta il tipo di sovrimpressione UWF su ram o su disco.

Proprietà

Proprietà Tipo di dati Qualificatori Descrizione
CurrentSession Booleano [key, read] Indica la sessione per cui l'oggetto contiene le impostazioni.
- True per la sessione
- corrente False
per la sessione successiva che inizia dopo un riavvio.
Type UInt32 [lettura] Indica il tipo di sovrimpressione.
- 0 per una sovrimpressione basata su RAM 1 per una sovrimpressione
-
basata su disco.
MaximumSize SInt32 [lettura] Indica le dimensioni massime della cache, in megabyte, della sovrimpressione.

Osservazioni:

Le modifiche apportate alla configurazione della sovrimpressione diventano effettive al successivo riavvio in cui UWF è abilitato.

Prima di poter modificare le proprietà Type o MaximumSize , UWF deve essere disabilitato nella sessione corrente.

Esempio

Nell'esempio seguente viene illustrato come modificare le dimensioni massime o il tipo di archiviazione della sovrimpressione in UWF usando il provider Strumentazione gestione Windows (WMI) in uno script di PowerShell.

Lo script di PowerShell crea due funzioni per modificare la configurazione della sovrimpressione. Viene quindi illustrato come usare le funzioni. La prima funzione, Set-OverlaySize, imposta le dimensioni massime della sovrimpressione. La seconda funzione, Set-OverlayType, imposta il tipo di sovrimpressione su ram o su disco.

$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

Requisiti

Edizione per Windows Supportata
Windows Home No
Windows Pro No
Windows Enterprise
Windows Education
Windows IoT Enterprise

Informazioni di riferimento sul provider WMI del filtro di scrittura unificato

Filtro scrittura unificato