4

My clients are using "HP Elitebook 840" touch screen laptop and recently we launched a website for their service, unfortunately click events on buttons did not worked in the web site. After a long R&D we realized it was touch screen issue and mouse click events started working after disabling it.

More info here: Click events are not working in Chrome, but event fires when we execute it manually from console

Since there are more than 40 users having same touch screen laptops, we would like to run a script to disable the touch feature of these laptops. I think network admin needs to run powershell script to do it, but I could not figure it out how to write single script to disable the touch screen of systems

I was reading http://www.surfaceforums.net/threads/disable-the-touch-screen-to-use-the-pen.12338/ but since I am new to PowerShell so need more detailed steps.

Community
  • 1
  • 1
kudlatiger
  • 3,028
  • 8
  • 48
  • 98

5 Answers5

14

Powershell nuggets to disable/enable laptop touch screen. Tested in Windows 10 on Asus UX 501. Run as administrator.

Get-PnpDevice | Where-Object {$_.FriendlyName -like '*touch screen*'} | Disable-PnpDevice -Confirm:$false

Get-PnpDevice | Where-Object {$_.FriendlyName -like '*touch screen*'} | Enable-PnpDevice -Confirm:$false

(Source)

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
Stephen Boston
  • 971
  • 1
  • 12
  • 23
  • Wow! This just works "out of the box". No restart required, no Devcon, not even a device ID, nothing! – Christoph Oct 05 '18 at 09:31
  • This should be the accepted answer! Works on my Lenovo Yoga, takes barely a second, and no reboot required! – Arcanox Mar 22 '20 at 22:16
  • I have been using this in a Powershell script for many clients that come in to my tech shop. This no longer seems to work as flawlessly as it once did. – user1023102 Feb 22 '21 at 21:10
2

Use this in PowerShell:

Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Wisp\Touch -Name TouchGate -Value 0 -Type DWord

Restart machine after.

Vaidas
  • 1,494
  • 14
  • 21
1

You can use the following registry key to disable touch input (requires a reboot):

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Wisp\Touch]
"TouchGate"=dword:00000000

Or with PowerShell:

Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Wisp\Touch ompany -Name TouchGate -Value 0 -Type DWord
Johan de Haan
  • 1,010
  • 9
  • 13
1

After some trial and error, I decided the best thing for me was to save two .bat files to handle this so that I could easily launch it using Launchy. Code below - you might need to add in logic to for the ExecutionPolicy based on your configuration, but works for me as written.

Copy this into notepad and save it as a .bat - just switch out "Disable" for "Enable" and you're good to go either direction

@ECHO off
Powershell.exe -Command "& {Start-Process Powershell.exe -ArgumentList '-Command ""& {Get-PNPDevice | Where-Object FriendlyName -Like ''*touch screen*'' | Disable-PNPDevice -Confirm:$false} ; Get-PNPDevice | Where-Object FriendlyName -Like ''*touch screen*'' ; if ($Host.Name -eq ''ConsoleHost'') {Write-Host ''Press any key to continue...'' ; $Host.UI.RawUI.FlushInputBuffer() ; $Host.UI.RawUI.ReadKey(''""NoEcho,IncludeKeyUp''"") > $null}""' -Verb RunAs}"
immobile2
  • 489
  • 2
  • 15
1

I found this question and saw the answers, which are good. However, I found that I didn't want two different scripts to enable/disable the touch screen. I wanted to have it under one to just toggle it's state, so I wrote this script:

# To allow script to be executed on double click
# https://stackoverflow.com/a/30644946/1366368

# To sign script
# https://adamtheautomator.com/how-to-sign-powershell-script/

# To automatically elevate script to admin privs, I used this code fromn https://superuser.com/a/532109/222708
param([switch]$Elevated)

function Test-Admin {
    $currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
    $currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
}

if ((Test-Admin) -eq $false)  {
    if ($elevated) {
        # tried to elevate, did not work, aborting
    } else {
        # Removed -noexit as it will force the powershell instance to keep running after finishing
        Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -file "{0}" -elevated' -f ($myinvocation.MyCommand.Definition))
    }
    exit
}

# If Status of touch screen is Error, then it is off.
$result = (Get-PnpDevice|Where-Object {$_.FriendlyName -like '*touch screen*'}|Select -ExpandProperty 'Status')
if ($result -eq 'Error') {
  Write-Host "Enabling touch screen"
  Get-PnpDevice|Where-Object {$_.FriendlyName -like '*touch screen*'}|Enable-PnpDevice -Confirm:$false
} else {
  Write-Host "Disabling touch screen"
  Get-PnpDevice|Where-Object {$_.FriendlyName -like '*touch screen*'}|Disable-PnpDevice -Confirm:$false
}
Adrian
  • 10,246
  • 4
  • 44
  • 110