Condividi tramite


UWF_RegistryFilter

Aggiunge o rimuove le esclusioni del Registro di sistema dal filtro UWF (Unified Write Filter) e esegue anche il commit delle modifiche del Registro di sistema.

Sintassi

class UWF_RegistryFilter{
    [key, Read] boolean CurrentSession;
    [Read, Write] boolean PersistDomainSecretKey;
    [Read, Write] boolean PersistTSCAL;

    UInt32 AddExclusion(
        string RegistryKey
    );
    UInt32 RemoveExclusion(
        string RegistryKey
    );
    UInt32 FindExclusion(
        [in] string RegistryKey,
        [out] boolean bFound
    );
    UInt32 GetExclusions(
        [out, EmbeddedInstance("UWF_ExcludedRegistryKey")] string ExcludedKeys[]
    );
    UInt32 CommitRegistry(
        [in] string RegistryKey,
        [in] string ValueName
    );
    UInt32 CommitRegistryDeletion(
        string Registrykey,
        string ValueName
    );
};

Membri

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

Metodo Descrizione
UWF_RegistryFilter.AddExclusion Aggiunge una chiave del Registro di sistema all'elenco di esclusione del Registro di sistema per UWF.
UWF_RegistryFilter.CommitRegistry Esegue il commit delle modifiche apportate alla chiave e al valore del Registro di sistema specificati.
UWF_RegistryFilter.CommitRegistryDeletion Elimina la chiave del Registro di sistema o il valore del Registro di sistema specificato e ne esegue il commit.
UWF_RegistryFilter.FindExclusion Determina se una chiave del Registro di sistema specifica viene esclusa dal filtro in base a UWF.
UWF_RegistryFilter.GetExclusions Recupera tutte le esclusioni di chiavi del Registro di sistema da un sistema protetto da UWF
UWF_RegistryFilter.RemoveExclusion Rimuove una chiave del Registro di sistema dall'elenco di esclusione del Registro di sistema per UWF (Unified Write Filter).

Proprietà

Proprietà Tipo di dati Qualificazioni Descrizione
CurrentSession Booleano [chiave, lettura] Indica la sessione per cui l'oggetto contiene le impostazioni.
- True se le impostazioni sono relative alla sessione
- corrente False se le impostazioni riguardano la sessione successiva che segue un riavvio.
PersistDomainSecretKey Booleano [lettura, scrittura] Indica se la chiave del Registro di sistema del segreto di dominio è presente nell'elenco di esclusione del Registro di sistema. Se la chiave del Registro di sistema non è presente nell'elenco di esclusione, le modifiche non vengono mantenute dopo un riavvio.
- True per includere nell'elenco
di esclusione- In caso contrario False.
PersistTSCAL Booleano [lettura, scrittura] Indica se la chiave del Registro di sistema TSCAL (Client Access License) di Terminal Server è presente nell'elenco di esclusione del Registro di sistema UWF. Se la chiave del Registro di sistema non è presente nell'elenco di esclusione, le modifiche non vengono mantenute dopo un riavvio.
- True per includere nell'elenco
di esclusione- In caso contrario, impostare su False

Osservazioni

Le aggiunte o le rimozioni delle esclusioni del Registro di sistema, incluse le modifiche ai valori di PersistDomainSecretKey e PersistTSCAL, diventano effettive dopo il riavvio successivo in cui è abilitato UWF.

È possibile aggiungere solo chiavi del Registro di sistema nella radice del Registro di sistema HKLM all'elenco di esclusione del Registro di sistema UWF.

È anche possibile usare UWF_RegistryFilter per escludere la chiave del Registro di sistema del segreto di dominio e la chiave del Registro di sistema TSCAL dal filtro UWF.

Esempio

Nell'esempio seguente viene illustrato come gestire le esclusioni del Registro di sistema UWF usando il provider Strumentazione gestione Windows (WMI) in uno script di PowerShell.

Lo script di PowerShell crea quattro funzioni e quindi illustra come usarle.

La prima funzione , Get-RegistryExclusions, visualizza un elenco di esclusioni del Registro di sistema UWF sia per la sessione corrente che per la sessione successiva che segue un riavvio.

La seconda funzione, Add-RegistryExclusion, aggiunge una voce del Registro di sistema all'elenco di esclusione del Registro di sistema UWF dopo il riavvio del dispositivo.

La terza funzione , Remove-RegistryExclusion, rimuove una voce del Registro di sistema dall'elenco di esclusione UWF dopo il riavvio del dispositivo.

La quarta funzione , Clear-RegistryExclusions, rimuove tutte le esclusioni del Registro di sistema UWF. È necessario riavviare il dispositivo prima che UWF smetta di filtrare le esclusioni.

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

# Define common parameters

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

function Get-RegistryExclusions() {

# This function lists the UWF registry exclusions, both
# for the current session as well as the next session after a restart.


# Get the UWF_RegistryFilter configuration for the current session

    $currentConfig = Get-WMIObject -class UWF_RegistryFilter @CommonParams |
        where {
            $_.CurrentSession -eq $true
        };

# Get the UWF_RegistryFilter configuration for the next session after a restart

    $nextConfig = Get-WMIObject -class UWF_RegistryFilter @CommonParams |
        where {
            $_.CurrentSession -eq $false
        };

# Display registry exclusions for the current session

    if ($currentConfig) {

        Write-Host ""
        Write-Host "The following registry entries are currently excluded from UWF filtering:";

        $currentExcludedList = $currentConfig.GetExclusions()

        if ($currentExcludedList.ExcludedKeys) {
            foreach ($registryExclusion in $currentExcludedList.ExcludedKeys)  {
                Write-Host "  " $registryExclusion.RegistryKey
            }
        } else {
            Write-Host "  None"
        }
    } else {
        Write-Error "Could not retrieve UWF_RegistryFilter.";
}

# Display registry exclusions for the next session after a restart

    if ($nextConfig) {

        Write-Host ""
        Write-Host "The following registry entries will be excluded from UWF filtering after the next restart:";

        $nextExcludedList = $nextConfig.GetExclusions()

        if ($nextExcludedList.ExcludedKeys) {
            foreach ($registryExclusion in $nextExcludedList.ExcludedKeys)  {
                Write-Host "  " $registryExclusion.RegistryKey
            }
        } else {
            Write-Host "  None"
        }
        Write-Host ""
    }
}

function Add-RegistryExclusion($exclusion) {

# This function adds a new UWF registry exclusion.
# The new registry exclusion takes effect the next time the device is restarted and UWF is enabled.

# $exclusion is the path of the registry exclusion

# Get the UWF_RegistryFilter configuration for the next session after a restart

    $nextConfig = Get-WMIObject -class UWF_RegistryFilter @CommonParams |
        where {
            $_.CurrentSession -eq $false
        };

# Add the exclusion

    if ($nextConfig) {
        $nextConfig.AddExclusion($exclusion) | Out-Null;
        Write-Host "Added exclusion $exclusion.";
    } else {
        Write-Error "Could not retrieve UWF_RegistryFilter";
    }
}

function Remove-RegistryExclusion($exclusion) {

# This function removes a UWF registry exclusion.
# The registry exclusion is removed the next time the device is restarted

# $exclusion is the path of the registry exclusion

# Get the UWF_RegistryFilter configuration for the next session after a restart

    $nextConfig = Get-WMIObject -class UWF_RegistryFilter @CommonParams |
        where {
            $_.CurrentSession -eq $false
        };

# Try to remove the exclusion

    if ($nextConfig) {
        try {
            $nextConfig.RemoveExclusion($exclusion) | Out-Null;
            Write-Host "Removed exclusion $exclusion.";
        } catch {
            Write-Host "Could not remove exclusion $exclusion."
        }
    } else {
        Write-Error "Could not retrieve UWF_RegistryFilter";
    }
}

function Clear-RegistryExclusions() {

# This function removes all UWF registry exclusions
# The registry exclusions are removed the next time the device is restarted

# Get the configuration for the next session

    $nextConfig = Get-WMIObject -class UWF_RegistryFilter @CommonParams |
        where {
            $_.CurrentSession -eq $false
        };

# Remove all registry exclusions

    if ($nextConfig) {

        Write-Host "Removing all registry exclusions:";

        $nextExcludedList = $nextConfig.GetExclusions()

        if ($nextExcludedList) {
            foreach ($registryExclusion in $nextExcludedList.ExcludedKeys)  {
                Write-Host "Removing:" $registryExclusion.RegistryKey
                $nextConfig.RemoveExclusion($registryExclusion.RegistryKey) | Out-Null
            }
        } else {
            Write-Host "No registry exclusions to remove."
        }
        Write-Host ""
    }
}

# Some examples of using the functions

Clear-RegistryExclusions

Get-RegistryExclusions

Add-RegistryExclusion "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer"
Add-RegistryExclusion "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers\(Default)"

Get-RegistryExclusions

Remove-RegistryExclusion "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer"

Get-RegistryExclusions

Clear-RegistryExclusions

Requisiti

Edizione di Windows Supportato
Windows Home No
Windows Pro No
Windows Enterprise
Windows Education
Windows IoT Enterprise