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
);
};
Члены
В следующих таблицах перечислены методы и свойства, принадлежащие этому классу.
Метод | Описание |
---|---|
UWF_RegistryFilter.AddExclusion | Добавляет раздел реестра в список исключений реестра для UWF. |
UWF_RegistryFilter.CommitRegistry | Фиксирует изменения в указанном разделе реестра и значении. |
UWF_RegistryFilter.CommitRegistryDeletion | Удаляет указанный раздел реестра или значение реестра и фиксирует удаление. |
UWF_RegistryFilter.FindExclusion | Определяет, исключен ли определенный раздел реестра из фильтрации по UWF. |
UWF_RegistryFilter.GetExclusions | Извлекает все исключения разделов реестра из системы, защищенной UWF. |
UWF_RegistryFilter.RemoveExclusion | Удаляет раздел реестра из списка исключений реестра для единого фильтра записи (UWF). |
Свойства
Свойство | Тип данных | Квалификаторы | Описание |
---|---|---|---|
CurrentSession | Boolean (Логическое) | [ключ, чтение] | Указывает, для какого сеанса объект содержит параметры.
- True , если для текущего сеанса - задано значение False , если параметры предназначены для следующего сеанса, следующего за перезапуском. |
PersistDomainSecretKey | Boolean (Логическое) | [чтение, запись] | Указывает, находится ли раздел реестра секретов домена в списке исключений реестра. Если раздел реестра отсутствует в списке исключений, изменения не сохраняются после перезапуска. - Значение true для включения в список исключений — в противном случае false. |
PersistTSCAL | Boolean (Логическое) | [чтение, запись] | Указывает, находится ли раздел реестра клиентской лицензии сервера терминалов (TSCAL) в списке исключений реестра UWF. Если раздел реестра отсутствует в списке исключений, изменения не сохраняются после перезапуска.
- Значение true для включения в список исключений. В противном случае задайте значение False. |
Комментарии
Добавление или удаление исключений реестра, включая изменения значений PersistDomainSecretKey и PersistTSCAL, вступают в силу после следующего перезапуска, в котором включен UWF.
Разделы реестра можно добавлять только в корневом каталоге реестра HKLM в список исключений реестра UWF.
Вы также можете использовать UWF_RegistryFilter , чтобы исключить раздел реестра секретов домена и раздел реестра TSCAL из фильтрации UWF.
Пример
В следующем примере показано, как управлять исключениями реестра UWF с помощью поставщика инструментария управления Windows (WMI) в скрипте PowerShell.
Скрипт PowerShell создает четыре функции, а затем демонстрирует их использование.
Первая функция Get-RegistryExclusions отображает список исключений реестра UWF как для текущего сеанса, так и для следующего сеанса, следующего за перезапуском.
Вторая функция Add-RegistryExclusion добавляет запись реестра в список исключений реестра UWF после перезапуска устройства.
Третья функция Remove-RegistryExclusion удаляет запись реестра из списка исключений UWF после перезапуска устройства.
Четвертая функция 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 Корпоративная | Да |
Windows для образовательных учреждений | Да |
Windows IoT Enterprise | Да |