WEKF_PredefinedKey
Kelas ini memblokir atau membuka blokir kombinasi kunci yang telah ditentukan sebelumnya, seperti Ctrl+Alt+Delete.
Sintaks
class WEKF_PredefinedKey {
[Static] uint32 Enable (
[In] string PredefinedKey
);
[Static] uint32 Disable (
[In] string PredefinedKey
);
[Key] string Id;
[Read, Write] boolean Enabled;
};
Anggota
Tabel berikut mencantumkan konstruktor, metode, bidang, dan properti apa pun yang termasuk dalam kelas ini.
Metode
Metode | Deskripsi |
---|---|
WEKF_PredefinedKey.Enable | Memblokir kunci yang telah ditentukan sebelumnya. |
WEKF_PredefinedKey.Disable | Membuka blokir kunci yang telah ditentukan sebelumnya. |
Properti
Properti | Jenis Data | Kualifikasi | Deskripsi |
---|---|---|---|
Id | string | [kunci] | Nama kombinasi kunci yang telah ditentukan sebelumnya. |
Aktif | Boolean | [baca, tulis] | Menunjukkan apakah kunci diblokir atau tidak diblokir. Untuk menunjukkan bahwa kunci diblokir, tentukan true. Untuk menunjukkan bahwa kunci tidak diblokir, tentukan false. |
Keterangan
Semua akun memiliki akses baca ke kelas WEKF_PRedefinedKey , tetapi hanya akun administrator yang dapat memodifikasi kelas.
Untuk daftar kombinasi tombol yang telah ditentukan sebelumnya untuk Filter Keyboard, lihat Kombinasi tombol yang telah ditentukan sebelumnya.
Contoh
Contoh skrip Windows PowerShell berikut memblokir kombinasi tombol Ctrl+Alt+Delete dan Ctrl+Esc saat layanan Filter Keyboard berjalan.
<#
.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"
Persyaratan
Edisi Windows | Didukung |
---|---|
Windows Home | Tidak |
Windows Pro | Tidak |
Windows Enterprise | Ya |
Windows Education | Ya |
Windows IoT Enterprise | Ya |