鍵盤篩選器Keyboard Filter

您可以使用「鍵盤篩選器」來抑制不想要的按鍵或按鍵組合。You can use Keyboard Filter to suppress undesirable key presses or key combinations. 一般情況下,客戶可以使用某些 Microsoft Windows 按鍵組合(例如 Ctrl + Alt + Delete 或 Ctrl + Shift + Tab)來改變裝置的運作方式,方法是鎖定畫面或使用工作管理員關閉執行中的應用程式。Normally, a customer can use certain Microsoft Windows key combinations like Ctrl+Alt+Delete or Ctrl+Shift+Tab to alter the operation of a device by locking the screen or using Task Manager to close a running application. 如果您的裝置適用于專用用途,這可能不是理想的做法。This may not be desirable if your device is intended for a dedicated purpose.

鍵盤篩選功能適用于實體鍵盤、Windows 螢幕小鍵盤和觸控鍵盤。The Keyboard Filter feature works with physical keyboards, the Windows on-screen keyboard, and the touch keyboard. 鍵盤篩選也會偵測動態配置變更,例如,從某個語言集切換至另一種語言,然後繼續正確地隱藏按鍵,即使隱藏的按鍵位置已在鍵盤配置上變更也一樣。Keyboard Filter also detects dynamic layout changes, such as switching from one language set to another, and continues to suppress keys correctly, even if the location of suppressed keys has changed on the keyboard layout.

注意

遠端桌面會話不支援鍵盤篩選。Keyboard filter is not supported in a remote desktop session.

需求Requirements

Windows 10 企業版或 Windows 10 教育版。Windows 10 Enterprise or Windows 10 Education.

術語Terminology

  • 開啟、啟用: 讓設定可供裝置使用,並選擇性地將設定套用至裝置。Turn on, enable: To make the setting available to the device and optionally apply the settings to the device. 通常會在使用者介面或控制台中使用 [ 開啟 ],而 [ 啟用 ] 則用於命令列。Generally turn on is used in the user interface or control panel, whereas enable is used for command line.

  • 設定: 以自訂設定或子設定。Configure: To customize the setting or sub-settings.

  • 內嵌鍵盤篩選器: 這項功能在 Windows 10 1511 版中稱為「內嵌鍵盤篩選」。Embedded Keyboard Filter: This feature is called Embedded Keyboard Filter in Windows 10, version 1511.

  • 鍵盤篩選器: 這項功能在 Windows 10 1607 版和更新版本中稱為「鍵盤篩選」。Keyboard Filter: This feature is called Keyboard Filter in Windows 10, version 1607 and later.

開啟鍵盤篩選器Turn on Keyboard Filter

依預設,鍵盤篩選器不會開啟。By default, Keyboard Filter is not turned on. 您可以使用下列步驟來開啟或關閉裝置的鍵盤篩選。You can turn Keyboard Filter on or off for your device by using the following steps.

開啟關閉鍵盤篩選器需要您重新開機裝置。Turning on an off Keyboard Filter requires that you restart your device. 重新開機之後,鍵盤篩選器會自動啟用。Keyboard Filter is automatically enabled after the restart.

使用主控台開啟鍵盤篩選Turn on Keyboard Filter by using Control Panel

  1. 在 [ 搜尋 web 和 Windows ] 欄位中,輸入 [ 程式和功能 ],然後按下 enter 或按一下 [ 程式和功能 ] 來開啟它。In the Search the web and Windows field, type Programs and Features and either press Enter or tap or click Programs and Features to open it.
  2. 在 [ 程式和功能 ] 視窗中,按一下 [ 開啟或關閉 Windows 功能 ]。In the Programs and Features window, click Turn Windows features on or off.
  3. 在 [ Windows 功能 ] 視窗中,展開 [ 裝置鎖定 ] 節點,然後選取或清除 鍵盤篩選 的核取方塊。In the Windows Features window, expand the Device Lockdown node, and select or clear the checkbox for Keyboard Filter.
  4. 按一下 [確定] 。Click OK. [ Windows 功能 ] 視窗表示 Windows 10 正在搜尋必要的檔案,並顯示進度列。The Windows Features window indicates Windows 10 is searching for required files and displays a progress bar. 找到後,視窗會指出 Windows 10 正在套用變更。Once found, the window indicates Windows 10 is applying the changes. 完成時,視窗會指出所要求的變更已完成。When completed, the window indicates the requested changes are completed.
  5. 按一下 [ 關閉 ] 以關閉 [ Windows 功能 ] 視窗。Click Close to close the Windows Features window.

使用自動安裝來設定鍵盤Configure Keyboard using Unattend

  1. 您可以設定 KeyboardFilterService 元件中的自動安裝設定,在設計或映射處理階段期間,將鍵盤篩選功能新增至您的影像。You can configure the Unattend settings in the Microsoft-Windows-Embedded-KeyboardFilterService component to add Keyboard Filter features to your image during the design or imaging phase.
  2. 您可以手動建立自動安裝回應檔案,或使用 Windows 系統映射管理員 (Windows SIM) ,將適當的設定新增至您的回應檔案。You can manually create an Unattend answer file or use Windows System Image Manager (Windows SIM) to add the appropriate settings to your answer file. 如需有關鍵盤篩選器設定和 XML 範例的詳細資訊,請參閱 Microsoft Windows Embedded-KeyboardFilterService中的設定。For more information about the keyboard filter settings and XML examples, see the settings in Microsoft-Windows-Embedded-KeyboardFilterService.

使用 Windows 設定設計工具開啟和設定鍵盤篩選器Turn on and configure Keyboard Filter using Windows Configuration Designer

鍵盤篩選器設定也可作為 Windows 布建設定,讓您可以設定在映射部署時間或執行時間時套用這些設定。The Keyboard Filter settings are also available as Windows provisioning settings so you can configure these settings to be applied during the image deployment time or runtime. 您可以使用 Windows 設定設計工具建立布建套件,然後在映射部署時間或執行時間套用布建套件,來設定一或多個鍵盤篩選器設定。You can set one or all keyboard filter settings by creating a provisioning package using Windows Configuration Designer and then applying the provisioning package during image deployment time or runtime.

  1. 遵循 建立布建套件中的指示,在 Windows 設定設計工具中建立布建套件。Build a provisioning package in Windows Configuration Designer by following the instructions in Create a provisioning package.

    注意

    在 [ 選取 Windows 版本 ] 視窗中,選擇 [ 通用至所有 Windows 桌上出版本 ]。In the Select Windows Edition window, choose Common to all Windows desktop editions.

  2. 在 [ 可用的自訂 ] 頁面上,選取 [ 執行時間設定 > SMISettings ],然後設定所需的鍵盤篩選設定值。On the Available customizations page, select Runtime settings > SMISettings , and then set the desired values for the keyboard filter settings.

  3. 完成設定和建立布建套件之後,您可以將套件套用至映射部署時間或執行時間。Once you have finished configuring the settings and building the provisioning package, you can apply the package to the image deployment time or runtime. 如需詳細資訊,請參閱套用布建 套件See Apply a provisioning package for more information. 請注意,將布建 packageg 套用至 Windows 10 企業版映射的程式相同。Note that the process for applying the provisioning packageg to a Windows 10 Enterprise image is the same.

此範例使用稱為 install 的 Windows 映像,但您可以使用相同的程式來套用布建套件。This example uses a Windows image called install.wim, but you can use the same procedure to apply a provisioning package. 如需 DISM 的詳細資訊,請參閱 什麼是部署映射服務與管理For more information on DISM, see What Is Deployment Image Servicing and Management.

使用 DISM 開啟和設定鍵盤篩選器Turn on and configure Keyboard Filter by using DISM

  1. 以系統管理員權限開啟命令提示字元。Open a command prompt with administrator privileges.

  2. 將安裝 .wim 複製到硬碟上的暫存資料夾 (在下列步驟中,我們會假設它稱為 C: \ wim) 。Copy install.wim to a temporary folder on hard drive (in the following steps, we'll assume it's called C:\wim).

  3. 建立新的目錄。Create a new directory.

    md c:\wim
    
  4. 掛接映像。Mount the image.

    dism /mount-wim /wimfile:c:\bootmedia\sources\install.wim /index:1 /MountDir:c:\wim
    
  5. 啟用此功能。Enable the feature.

    Dism /online /Enable-Feature /FeatureName:Client-KeyboardFilter
    
  6. 認可變更。Commit the change.

    dism /unmount-wim /MountDir:c:\wim /Commit
    

鍵盤篩選功能Keyboard Filter features

鍵盤篩選具有下列功能:Keyboard Filter has the following features:

  • 支援硬體鍵盤、標準 Windows 螢幕小鍵盤和觸控鍵盤 ( # A0) 。Supports hardware keyboards, the standard Windows on-screen keyboard, and the touch keyboard (TabTip.exe).

  • 抑制按鍵組合,即使它們來自多個鍵盤也一樣。Suppresses key combinations even when they come from multiple keyboards.

    例如,如果使用者按下 Ctrl 鍵,然後在硬體鍵盤上按下 ALT 鍵,同時在軟體鍵盤上按下 Delete 鍵,鍵盤篩選仍可以偵測並隱藏 Ctrl + Alt + Delete 功能。For example, if a user presses the Ctrl key and the Alt key on a hardware keyboard, while at the same time pressing Delete on a software keyboard, Keyboard Filter can still detect and suppress the Ctrl+Alt+Delete functionality.

  • 支援針對存取 media player 和瀏覽器功能而設計的數值鍵盤和金鑰。Supports numeric keypads and keys designed to access media player and browser functionality.

  • 可以設定金鑰,將鎖定的使用者會話分類,以回到歡迎畫面。Can configure a key to breakout of a locked down user session to return to the Welcome screen.

  • 自動處理動態配置變更。Automatically handles dynamic layout changes.

  • 系統管理員帳戶可以啟用或停用。Can be enabled or disabled for administrator accounts.

  • 可以強制停用輕鬆存取功能。Can force disabling of Ease of Access functionality.

  • 可以封鎖實體硬體金鑰。Can block physical hardware keys.

  • 支援 x86 和 x64 架構。Supports x86 and x64 architectures.

鍵盤掃描碼和版面配置Keyboard scan codes and layouts

當在實體鍵盤上按下按鍵時,鍵盤便會傳送掃描碼給鍵盤驅動程式。When a key is pressed on a physical keyboard, the keyboard sends a scan code to the keyboard driver. 驅動程式便會將掃描碼傳送到 OS,而 OS 便會基於現有使用中的配置,將掃描碼轉換為虛擬按鍵碼。The driver then sends the scan code to the OS and the OS converts the scan code into a virtual key based on the current active layout. 配置會定義實體鍵盤上的按鍵對應,且有許多變異。The layout defines the mapping of keys on the physical keyboard, and has many variants. 鍵盤上的按鍵一律會在按下時傳送相同的掃描程式碼,不過,此掃描程式碼可對應至不同的虛擬機器碼以進行不同的配置。A key on a keyboard always sends the same scan code when pressed, however this scan code can map to different virtual keys for different layouts. 例如,在英文 (美國) 鍵盤配置中,P 按鍵右邊的索引鍵會對應到 "{"。For example, in the English (United States) keyboard layout, the key to the right of the P key maps to “{“. 不過,在瑞典文 (瑞典) 鍵盤配置中,相同的按鍵會對應至 "Å"。However, in the Swedish (Sweden) keyboard layout, the same key maps to “Å”.

鍵盤篩選器可以透過掃描碼或虛擬機器碼來封鎖按鍵。Keyboard Filter can block keys either by the scan code or the virtual key. 掃描程式碼的封鎖按鍵適用于具有特殊掃描碼且未轉譯成任何單一虛擬機器碼的自訂鍵盤。Blocking keys by the scan code is useful for custom keyboards that have special scan codes that do not translate into any single virtual key. 使用虛擬機器碼來封鎖金鑰通常更為方便,因為即使在配置變更的情況下,當金鑰的位置變更時,也能更輕鬆地讀取和鍵盤篩選器會隱藏金鑰。Blocking keys by the virtual key is generally more convenient because it is easier to read and Keyboard Filter suppresses the key correctly even when the location of the key changes because of a layout change.

當您使用虛擬機器碼設定鍵盤篩選器來封鎖金鑰時,您必須使用英文名稱作為虛擬機器碼。When you configure Keyboard Filter to block keys by using the virtual key, you must use the English names for the virtual keys. 如需虛擬機器碼名稱的詳細資訊,請參閱鍵盤篩選鍵名稱。For more information about the names of the virtual keys, see keyboard filter key names.

針對 Windows 螢幕小鍵盤,鍵盤篩選會根據配置將每個按鍵轉換成掃描程式碼,然後再轉換回虛擬機器碼。For the Windows on-screen keyboard, keyboard filter converts each keystroke into a scan code based on the layout, and back into a virtual key. 這可讓鍵盤篩選器以與實體鍵盤按鍵相同的方式來隱藏螢幕小鍵盤按鍵,不論是透過掃描程式碼或虛擬機器碼來設定。This allows keyboard filter to suppress the on-screen keyboard keys in the same manner as physical keyboard keys, whether they are configured by scan code or virtual key.

鍵盤篩選和輕鬆存取功能Keyboard Filter and ease of access features

依預設,會啟用 [輕鬆存取] 功能,並停用系統管理員帳戶的鍵盤篩選。By default, ease of access features are enabled and Keyboard Filter is disabled for administrator accounts.

如果相黏鍵已啟用,使用者在某些情況下可以略過鍵盤篩選。If Sticky Keys are enabled, a user can bypass Keyboard Filter in certain situations. 您可以設定鍵盤篩選器來停用所有的輕鬆存取功能,並防止使用者啟用這些功能。You can configure keyboard filter to disable all ease of access features and prevent users from enabling them.

您可以啟用系統管理員帳戶的輕鬆存取功能,同時仍可針對標準使用者帳戶停用這些功能,方法是確定系統管理員帳戶的鍵盤篩選已停用。You can enable ease of access features for administrator accounts, while still disabling them for standard user accounts, by making sure that Keyboard Filter is disabled for administrator accounts.

鍵盤篩選器設定Keyboard Filter configuration

您可以設定下列鍵盤篩選選項:You can configure the following options for Keyboard Filter:

  • 設定/取消設定要隱藏的預先定義金鑰組合。Set/unset predefined key combinations to be suppressed.
  • 新增/移除自訂定義的按鍵組合以隱藏。Add/remove custom defined key combinations to be suppressed.
  • 啟用/停用系統管理員帳戶的鍵盤篩選。Enable/disable keyboard filter for administrator accounts.
  • 強制停用輕鬆存取功能。Force disabling ease of access features.
  • 設定分組金鑰順序,以中斷已鎖定的帳戶。Configure a breakout key sequence to break out of a locked down account.

大部分的設定變更都會立即生效。Most configuration changes take effect immediately. 某些變更(例如啟用或停用系統管理員的鍵盤篩選器)在使用者登出帳戶再重新登入時才會生效。Some changes, such as enabling or disabling Keyboard Filter for administrators, do not take effect until the user signs out of the account and then back in. 如果您變更了「分類金鑰掃描碼」,則必須先重新開機裝置,變更才會生效。If you change the breakout key scan code, you must restart the device before the change take effect.

您可以使用 Windows Management Instrumentation (WMI) 提供者來設定鍵盤篩選器。You can configure keyboard filter by using Windows Management Instrumentation (WMI) providers. 您可以直接在 PowerShell 腳本或應用程式中使用鍵盤篩選器 WMI 提供者。You can use the Keyboard Filter WMI providers directly in a PowerShell script or in an application.

如需鍵盤篩選 WMI 提供者的詳細資訊,請參閱 鍵盤篩選 wmi 提供者參考For more information about Keyboard Filter WMI providers, see Keyboard Filter WMI provider reference.

鍵盤分組Keyboard breakout

您可能需要使用不同的帳戶登入鎖定的裝置,才能服務或設定裝置。You may need to sign in to a locked down device with a different account in order to service or configure the device. 您可以藉由指定金鑰掃描碼來設定分組金鑰,以中斷鎖定的帳戶。You can configure a breakout key to break out of a locked down account by specifying a key scan code. 當您按下 Ctrl + Alt + Delete 時,Windows 會顯示歡迎畫面,讓您可以登入不同的帳戶。When you press Ctrl+Alt+Delete, Windows presents the Welcome screen so that you can sign in to a different account.

依預設,會將 [排列] 索引鍵設定為左 Windows 標誌的掃描程式碼。The breakout key is set to the scan code for the left Windows logo key by default. 您可以使用 WEKF _ 設定WMI 類別來變更「分組金鑰」掃描程式碼。You can use the WEKF_SettingsWMI class to change the breakout key scan code. 如果您變更了「分類金鑰掃描碼」,則必須重新開機裝置,變更才會生效。If you change the breakout key scan code, you must restart the device before the change takes effect.

鍵盤篩選器考慮Keyboard Filter considerations

以安全模式啟動裝置會略過鍵盤篩選。Starting a device in Safe Mode bypasses keyboard filter. 鍵盤篩選器服務不是以安全模式載入,而且索引鍵不會在安全模式中封鎖。The Keyboard Filter service is not loaded in Safe Mode, and keys are not blocked in Safe Mode.

鍵盤篩選器無法封鎖睡眠金鑰。Keyboard filter cannot block the Sleep key.

某些硬體金鑰(例如輪替鎖定)沒有已定義的虛擬機器碼。Some hardware keys, such as rotation lock, do not have a defined virtual key. 您仍然可以使用金鑰的掃描碼來封鎖這些金鑰。You can still block these keys by using the scan code of the key.

[新增 (+) ]、[乘以 (] *) 、[減去 (]、[除以] ) / (和 [十進位 ) ]。 ( 索引鍵在數位鍵臺上具有不同的虛擬機器碼和掃描碼,而不是在主要鍵盤上。The add (+), multiply (*), subtract (-), divide (/), and decimal (.) keys have different virtual keys and scan codes on the numeric keypad than on the main keyboard. 您必須封鎖這兩個金鑰來封鎖這些金鑰。You must block both keys to block these keys. 例如,若要封鎖乘號索引鍵,您必須加入規則來封鎖「」以及 * 規則以封鎖乘法。For example, to block the multiply key, you must add a rule to block “*” as well as a rule to block Multiply.

使用螢幕小鍵盤或實體鍵盤和螢幕小鍵盤的組合來鎖定畫面時,螢幕小鍵盤會將額外的 Windows 標誌鍵按鍵傳送至 OS。When locking the screen by using the on-screen keyboard, or a combination of a physical keyboard and the on-screen keyboard, the on-screen keyboard sends an additional Windows logo key keystroke to the OS. 如果您的裝置使用 Windows 10 shell,而您使用鍵盤篩選器來封鎖 Windows 標誌鍵 + L,則額外的 Windows 標誌按鍵按鍵會導致 shell 在使用者嘗試使用螢幕小鍵盤(可能是非預期的行為)鎖定裝置時,于 開始 畫面和最後一個作用中應用程式之間切換。If your device is using the Windows 10 shell and you use keyboard filter to block Windows logo key+L, the extra Windows logo key keystroke causes the shell to switch between the Start screen and the last active app when a user attempts to lock the device by using the on-screen keyboard, which may be unexpected behavior.

某些自訂鍵盤軟體(例如 Microsoft IntelliType Pro)可以安裝鍵盤篩選器驅動程式,讓鍵盤篩選器無法封鎖部分或所有金鑰,通常是像是 BrowserHome 和搜尋的擴充金鑰。Some custom keyboard software, such as Microsoft IntelliType Pro, can install Keyboard Filter drivers that prevent Keyboard Filter from being able to block some or all keys, typically extended keys like BrowserHome and Search.

本節內容In this section