WEKF_PredefinedKey

このクラスを使用すると、Ctrl + Alt + Delete などの定義済みのキーの組み合わせをブロックしたり、ブロック解除したりすることができます。

構文

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

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

メンバー

次の表に、このクラスに属するコンストラクター、メソッド、フィールド、およびプロパティを示します。

メソッド

メソッド 説明
WEKF_PredefinedKey.Enable 指定した定義済みのキーをブロックします。
WEKF_PredefinedKey.Disable 指定した定義済みのキーをブロック解除します。

プロパティ

プロパティ データ型 修飾子 説明
Id string [key] 定義済みのキーの組み合わせの名前。
Enabled ブール型 [read, write] キーがブロックされているか、ブロック解除されているかを示します。 キーがブロックされていることを示すには、true を指定します。 キーがブロックされていないことを示すには、false を指定します。

解説

すべてのアカウントには、WEKF_PRedefinedKey クラスへの読み取りアクセス権がありますが、クラスを変更できるのは管理者アカウントのみです。

キーボード フィルターの定義済みのキーの組み合わせの一覧については、「あらかじめ定義されたキーの組み合わせ」を参照してください。

次の Windows PowerShell スクリプトの例では、キーボード フィルター サービスの実行中に、Ctrl + Alt + Delete および Ctrl + Esc というキーの組み合わせがブロックされています。

<#
.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"

必要条件

Windows エディション サポートされています
Windows Home いいえ
Windows Pro いいえ
Windows Enterprise はい
Windows Education はい
Windows IoT Enterprise

キーボード フィルター WMI プロバイダー リファレンス

キーボード フィルター