Created
January 13, 2017 06:07
-
-
Save schwartzmx/87f41a822095d8677f05b1c6b40b564b to your computer and use it in GitHub Desktop.
Block user input. Mouse, and keyboard are disabled for the duration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$code = @" | |
[DllImport("user32.dll")] | |
public static extern bool BlockInput(bool fBlockIt); | |
"@ | |
$userInput = Add-Type -MemberDefinition $code -Name UserInput -Namespace UserInput -PassThru | |
Function Disable-UserInput { | |
param([int]$Seconds=5) | |
$userInput::BlockInput($true) | out-null | |
Start-Sleep $seconds | |
$userInput::BlockInput($false) | out-null | |
} | |
Disable-UserInput |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment