UWF_Filter
Ativa ou desativa o Filtro de Escrita Unificado (UWF), repõe as definições de configuração para UWF e encerra ou reinicia o dispositivo.
Sintaxe
class UWF_Filter{
[key] string Id;
[read] boolean CurrentEnabled;
[read] boolean NextEnabled;
UInt32 Enable();
UInt32 Disable();
UInt32 ResetSettings();
UInt32 ShutdownSystem();
UInt32 RestartSystem();
};
Membros
As tabelas seguintes listam todos os métodos e propriedades que pertencem a esta classe.
Métodos
Métodos | Descrição |
---|---|
UWF_Filter.Enable | Ativa o UWF no próximo reinício. |
UWF_Filter.Disable | Desativa o UWF no próximo reinício. |
UWF_Filter.ResetSettings | Restaura as definições de UWF para o estado original que foi capturado no momento da instalação. |
UWF_Filter.ShutdownSystem | Encerra com segurança um sistema protegido pela UWF, mesmo que a sobreposição esteja cheia. |
UWF_Filter.RestartSystem | Reinicia com segurança um sistema protegido pela UWF, mesmo que a sobreposição esteja cheia. |
Propriedades
Propriedade | Tipo de dados | Qualificadores | Descrição |
---|---|---|---|
ID | string | [chave] | Um ID exclusivo. Esta definição está sempre definida para UWF_Filter |
CurrentEnabled | Booliano | [ler] | Indica se o UWF está ativado para a sessão atual. |
NextEnabled | Booliano | [ler] | Indica se o UWF está ativado após o reinício seguinte. |
Comentários
Tem de utilizar uma conta de administrador para efetuar alterações às definições de configuração do UWF. Os utilizadores com qualquer tipo de conta podem ler as definições de configuração atuais.
Exemplo
O exemplo seguinte demonstra como ativar ou desativar o UWF com o fornecedor WMI num script do PowerShell.
O script do PowerShell cria três funções para ajudar a ativar ou desativar o UWF. Em seguida, demonstra como utilizar cada função.
A primeira função, Disable-UWF
, obtém um objeto WMI para UWF_Filter e chama o método Disable() para desativar o UWF após o próximo reinício do dispositivo.
A segunda função, Enable-UWF
, obtém um objeto WMI para UWF_Filter e chama o método Enable() para ativar o UWF após o próximo reinício do dispositivo.
A terceira função, Display-UWFState
, examina as propriedades do objeto UWF_Filter e imprime as definições atuais para UWF_Filter.
$COMPUTER = "localhost"
$NAMESPACE = "root\standardcimv2\embedded"
# Create a function to disable the Unified Write Filter driver after the next restart.
function Disable-UWF() {
# Retrieve the UWF_Filter settings.
$objUWFInstance = Get-WMIObject -namespace $NAMESPACE -class UWF_Filter;
if(!$objUWFInstance) {
"Unable to retrieve Unified Write Filter settings."
return;
}
# Call the method to disable UWF after the next restart. This sets the NextEnabled property to false.
$retval = $objUWFInstance.Disable();
# Check the return value to verify that the disable is successful
if ($retval.ReturnValue -eq 0) {
"Unified Write Filter will be disabled after the next system restart."
} else {
"Unknown Error: " + "{0:x0}" -f $retval.ReturnValue
}
}
# Create a function to enable the Unified Write Filter driver after the next restart.
function Enable-UWF() {
# Retrieve the UWF_Filter settings.
$objUWFInstance = Get-WMIObject -namespace $NAMESPACE -class UWF_Filter;
if(!$objUWFInstance) {
"Unable to retrieve Unified Write Filter settings."
return;
}
# Call the method to enable UWF after the next restart. This sets the NextEnabled property to false.
$retval = $objUWFInstance.Enable();
# Check the return value to verify that the enable is successful
if ($retval.ReturnValue -eq 0) {
"Unified Write Filter will be enabled after the next system restart."
} else {
"Unknown Error: " + "{0:x0}" -f $retval.ReturnValue
}
}
# Create a function to display the current settings of the Unified Write Filter driver.
function Display-UWFState() {
# Retrieve the UWF_Filter object
$objUWFInstance = Get-WmiObject -Namespace $NAMESPACE -Class UWF_Filter;
if(!$objUWFInstance) {
"Unable to retrieve Unified Write Filter settings."
return;
}
# Check the CurrentEnabled property to see if UWF is enabled in the current session.
if($objUWFInstance.CurrentEnabled) {
$CurrentStatus = "enabled";
} else {
$CurrentStatus = "disabled";
}
# Check the NextEnabled property to see if UWF is enabled or disabled after the next system restart.
if($objUWFInstance.NextEnabled) {
$NextStatus = "enabled";
} else {
$NextStatus = "disabled";
}
}
# Some examples of how to call the functions
Display-UWFState
"Enabling Unified Write Filter"
Enable-UWF
Display-UWFState
"Disabling Unified Write Filter"
Disable-UWF
Display-UWFState
Requisitos
Edição do Windows | Com suporte |
---|---|
Windows Home | Não |
Windows Pro | Não |
Windows Enterprise | Sim |
Windows Education | Sim |
Windows IoT Enterprise | Sim |