Condividi tramite


WEKF_PredefinedKey

Edizioni
✅ supportate IoT Enterprise LTSC
✅ IoT Enterprise
✅ LTSC✅
Enterprise
✅ Education

Questa classe blocca o sblocca combinazioni di tasti predefinite, ad esempio CTRL+ALT+CANC.

Sintassi

class WEKF_PredefinedKey {
    [Static] uint32 Enable (
        [In] string PredefinedKey
    );
    [Static] uint32 Disable (
        [In] string PredefinedKey
    );

    [Key] string Id;
    [Read, Write] boolean Enabled;
};

Membri

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

Metodi

Metodi Descrizione
WEKF_PredefinedKey.Enable Blocca la chiave predefinita specificata.
WEKF_PredefinedKey.Disable Sblocca la chiave predefinita specificata.

Proprietà

Proprietà Tipo di dati Qualificazioni Descrizione
Id stringa [chiave] Nome della combinazione di chiavi predefinita.
Abilitato Booleano [lettura, scrittura] Indica se la chiave è bloccata o sbloccata. Per indicare che la chiave è bloccata, specificare true. Per indicare che la chiave non è bloccata, specificare false.

Osservazioni

Tutti gli account hanno accesso in lettura alla classe WEKF_PRedefinedKey , ma solo gli account amministratore possono modificare la classe.

Per un elenco delle combinazioni di tasti predefinite per Filtro tastiera, vedere Combinazioni di tasti predefinite.

Esempio

L'esempio seguente Windows PowerShell script blocca le combinazioni di tasti CTRL+ALT+CANC e CTRL+ESC quando il servizio Filtro tastiera è in esecuzione.

<#
.Synopsis
    This script shows how to use the built in WMI providers to enable and add
    Keyboard Filter rules through Windows PowerShell on the local computer.
.Parameter ComputerName
    Optional parameter to specify a remote machine that this script should
    manage.  If not specified, the script will execute all WMI operations
    locally.
#>
param (
    [String] $ComputerName
)

$CommonParams = @{"namespace"="root\standardcimv2\embedded"}
$CommonParams += $PSBoundParameters

function Enable-Predefined-Key($Id) {
    <#
    .Synposis
        Toggle on a Predefined Key Keyboard Filter Rule
    .Description
        Use Get-WMIObject to enumerate all WEKF_PredefinedKey instances,
        filter against key value "Id", and set that instance's "Enabled"
        property to 1/true.
    .Example
        Enable-Predefined-Key "Ctrl+Alt+Delete"

        Enable CAD filtering
#>

    $predefined = Get-WMIObject -class WEKF_PredefinedKey @CommonParams |
        where {
            $_.Id -eq "$Id"
        };

    if ($predefined) {
        $predefined.Enabled = 1;
        $predefined.Put() | Out-Null;
        Write-Host Enabled $Id
    } else {
        Write-Error $Id is not a valid predefined key
    }
}

# Some example uses of the function defined above.

Enable-Predefined-Key "Ctrl+Alt+Delete"
Enable-Predefined-Key "Ctrl+Esc"