次の方法で共有


UWF_RegistryFilter

統合書き込みフィルター (UWF) フィルター処理からレジストリの除外を追加または削除し、レジストリの変更もコミットします。

構文

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
    );
};

Members

次の表に、このクラスに属するメソッドとプロパティを示します。

メソッド 説明
UWF_RegistryFilter.AddExclusion UWF のレジストリ除外リストにレジストリ キーを追加します。
UWF_RegistryFilter.CommitRegistry 指定したレジストリ キーと値に対する変更をコミットします。
UWF_RegistryFilter.CommitRegistryDeletion 指定したレジストリ キーまたはレジストリ値を削除し、削除をコミットします。
UWF_RegistryFilter.FindExclusion 特定のレジストリ キーを UWF によってフィルター処理から除外するかどうかを決定します。
UWF_RegistryFilter.GetExclusions UWF によって保護されているシステムからすべてのレジストリ キーの除外を取得します
UWF_RegistryFilter.RemoveExclusion 統合書き込みフィルター (UWF) のレジストリ除外リストからレジストリ キーを削除します。

プロパティ

プロパティ データ型 修飾子 説明
CurrentSession ブール値 [キー、読み取り] オブジェクトに設定が含まれているセッションを示します。
- True の 場合、現在のセッションの設定
- False 再起動後の次のセッションの設定である場合。
PersistDomainSecretKey ブール値 [読み取り、書き込み] ドメイン シークレット レジストリ キーがレジストリの除外リストに含まれているかどうかを示します。 レジストリ キーが除外リストに含まれていない場合、restart.
- 後に変更は保持されません。除外リストに含める場合は true
-それ以外の場合は False
PersistTSCAL ブール値 [読み取り、書き込み] ターミナル サーバー クライアント アクセス ライセンス (TSCAL) レジストリ キーが UWF レジストリの除外リストに含まれているかどうかを示します。 レジストリ キーが除外リストに含まれていない場合、再起動後に変更は保持されません。
- 除外リストに含める場合は True
- それ以外の場合は False に設定します。

注釈

PersistDomainSecretKeyPersistTSCAL の値の変更など、レジストリの除外の追加または削除は、UWF が有効になっている次回の再起動後に有効になります。

HKLM レジストリ ルートのレジストリ キーは、UWF レジストリの除外リストにのみ追加できます。

UWF_RegistryFilterを使用して、ドメイン シークレット レジストリ キーと TSCAL レジストリ キーを UWF フィルター処理から除外することもできます。

次の例では、PowerShell スクリプトで Windows Management Instrumentation (WMI) プロバイダーを使用して UWF レジストリの除外を管理する方法を示します。

PowerShell スクリプトは、4 つの関数を作成し、その使用方法を示します。

最初の関数 Get-RegistryExclusions には、現在のセッションと再起動後の次のセッションの両方に対する UWF レジストリの除外の一覧が表示されます。

2 つ目の関数 Add-RegistryExclusion は、デバイスを再起動した後に、レジストリ エントリを UWF レジストリの除外リストに追加します。

3 番目の関数 Remove-RegistryExclusion は、デバイスを再起動した後、UWF 除外リストからレジストリ エントリを削除します。

4 番目の関数 Clear-RegistryExclusions は、すべての UWF レジストリの除外を削除します。 UWF が除外のフィルター処理を停止する前に、デバイスを再起動する必要があります。

$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

要件

Windows エディション サポートされています
Windows ホーム なし
Windows Pro なし
Windows Enterprise はい
Windows Education はい
Windows IoT Enterprise