特定のユーザー向けのPowershellキーボードフィルター

特定のユーザー向けのPowershellキーボードフィルター

Microsoft のこのページ:https://docs.microsoft.com/en-us/windows-hardware/customize/enterprise/keyboardfilter-add-blocked-key-combinations特定のキーの組み合わせを無効にする PowerShell スクリプトを作成する方法について説明します。

関連するコード スニペットは次のとおりです。

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.";
    }
}


Enable-Custom-Key "Windows+U"
# etc.

しかし、特定のユーザーに対してのみキーの組み合わせを無効にする方法はありますか? (つまり、同じコンピューターにキーの組み合わせを引き続き使用できる別の「管理者」ユーザーが必要です)

そのユーザーとしてログインしてスクリプトを実行すれば解決するかもしれないと思いましたが、Powershell を管理者として実行した場合にのみ機能するようです。その場合、ログアウトして別の「管理者」ユーザーとして再度ログインすると、ここでもキーの組み合わせがブロックされます。

Windows 10 IoT です。

(ちなみに、Powershell をまったく使用しない回答も歓迎します。以前はグループ ポリシー エディターを使用するように言われていましたが、キーボード フィルター セクションが見つかりませんでした)

答え1

DisableKeyboardFilterForAdministrators を試してください

関連情報