WEKF_CustomKey

사용자 지정 정의 키 조합을 추가하거나 제거합니다.

구문

class WEKF_CustomKey {
    [Static] uint32 Add(
        [In] string CustomKey
    );
    [Static] uint32 Remove(
        [In] string CustomKey
    );

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

구성원

다음 표에는 이 클래스에 속하는 모든 메서드와 속성이 나열되어 있습니다.

메서드

메서드 Description
WEKF_CustomKey.Add 새 사용자 지정 키 조합을 만들고 키보드 필터를 사용하여 새 키 조합을 차단합니다.
WEKF_CustomKey.Remove 지정된 사용자 지정 키 조합을 제거합니다. 키보드 필터가 제거된 키 조합의 차단을 중지합니다.

속성

속성 데이터 형식 한정자 설명
ID 문자열 [key] 사용자 지정 키 조합의 이름입니다.
Enabled Boolean [read, write] 키가 차단 또는 차단 해제되었는지 여부를 나타냅니다. 이 속성은 다음 값
- 중 하나일 수 있습니다. true 키를 차단했음을 나타냅니다.
- False 키가 차단되지 않음을 나타냅니다.

설명

이름에 한정자 키를 포함하여 키 조합을 지정할 수 있습니다. 가장 일반적인 한정자 이름은 “Ctrl”, “Shift”, “Alt” 및 “Win”입니다. 한정자가 아닌 키의 조합을 차단할 수 없습니다. 예를 들어 “Ctrl+Shift+F”의 키 조합을 차단할 수 있지만 “A+D”의 키 조합을 차단할 수는 없습니다.

Shift 수정 키를 차단하는 경우 키를 “Shift” + 수정되지 않은 키로 입력해야 합니다. 예를 들어 영어 키보드 레이아웃에서 % 키를 차단하려면 키를 “Shift+5”로 지정해야 합니다. “%”를 차단하려고 시도하면 키보드 필터가 대신 “5”를 차단합니다.

차단할 키 조합을 지정하는 경우 키에 영어 이름을 사용해야 합니다. 지정할 수 있는 키 이름 목록은 키보드 필터 키 이름을 참조하세요.

예제

다음 코드는 키보드 필터에 대한 WMI(Windows Management Instrumentation) 공급자를 사용하여 키보드 필터가 차단할 사용자 지정 키 조합을 추가하거나 사용하도록 설정하는 방법을 설명합니다. 이 예제에서는 속성을 직접 수정하고 WEKF_CustomKey에 정의된 메서드를 호출하지 않습니다.

<#
.Synopsis
    This script shows how to use the WMI provider 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-Custom-Key($Id) {
    <#
    .Synopsis
        Toggle on a Custom Key Keyboard Filter Rule
    .Description
        Use Get-WMIObject to enumerate all WEKF_CustomKey instances,
        filter against key value "Id", and set that instance's "Enabled"
        property to 1/true.

        In the case that the Custom instance does not exist, add a new
        instance of WEKF_CustomKey using Set-WMIInstance.
    .Example
        Enable-Custom-Key "Ctrl+V"

        Enable filtering of the Ctrl + V sequence.
#>

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

    if ($custom) {
# Rule exists.  Just enable it.
        $custom.Enabled = 1;
        $custom.Put() | Out-Null;
        "Enabled Custom Filter $Id.";

    } else {
        Set-WMIInstance `
            -class WEKF_CustomKey `
            -argument @{Id="$Id"} `
            @CommonParams | Out-Null

        "Added Custom Filter $Id.";
    }
}


# Some example uses of the function defined above.

Enable-Custom-Key "Ctrl+V"
Enable-Custom-Key "Numpad0"
Enable-Custom-Key "Shift+Numpad1"

요구 사항

Windows 버전 지원됨
Windows Home No
Windows Pro No
Windows Enterprise Yes
Windows Education Yes
Windows IoT Enterprise

키보드 필터 WMI 공급자 참조

키보드 필터 키 이름