次の方法で共有


WEKF_PredefinedKey

サポートされているエディション
✅ IoT Enterprise LTSC
✅ IoT Enterprise
✅ Enterprise LTSC
✅ Enterprise
✅ Education

このクラスは、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;
};

Members

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

メソッド

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

プロパティ

プロパティ データ型 修飾子 説明
Id 文字列 [キー] 定義済みのキーの組み合わせの名前。
Enabled ブール値 [読み取り、書き込み] キーがブロックされているかブロック解除されているかを示します。 キーがブロックされていることを示すには、 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"