Skip to content

Instantly share code, notes, and snippets.

@qihuahu
Last active July 23, 2023 04:56
Show Gist options
  • Save qihuahu/26f9aae48c6f735051a86084ac156c34 to your computer and use it in GitHub Desktop.
Save qihuahu/26f9aae48c6f735051a86084ac156c34 to your computer and use it in GitHub Desktop.
Disable Touch Pad with PowerShell Script
$DeviceName = "HID-compliant touch pad"
if(!([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList "-File `"$($MyInvocation.MyCommand.Path)`" `"$($MyInvocation.MyCommand.UnboundArguments)`""
Exit
}
Get-PnpDevice -FriendlyName $DeviceName | Enable-PnpDevice -Confirm:$false
Get-PnpDevice -FriendlyName $DeviceName | Disable-PnpDevice -Confirm:$false
@qihuahu
Copy link
Author

qihuahu commented Jul 23, 2023

Make sure to run Set-ExecutionPolicy Unrestricted in PowerShell before running the script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment