WEKF_PredefinedKey
支持的版本
✅IoT 企业 LTSC
✅ IoT 企业
✅版 LTSC
✅ 企业教育版
✅
此类阻止或取消阻止预定义的键组合,例如 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 | 字符串 | [key] | 预定义组合键的名称。 |
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"