Forked from neo7BF/ManageDeviceInputFromPowershell.ps1
Last active
July 30, 2021 10:45
-
-
Save ltpitt/a4c0503308476c0da52fb3b3a3c7d0ac to your computer and use it in GitHub Desktop.
Devices input management from powershell
This file contains 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
#################### | |
# KEYBOARD VERSION # | |
#################### | |
$shell = New-Object -ComObject WScript.Shell | |
while(1) { | |
$shell.sendkeys("{NUMLOCK}{NUMLOCK}") | |
$time = Get-Date; | |
$shorterTimeString = $time.ToString("HH:mm:ss"); | |
Write-Host $shorterTimeString "NUMLOCK pressed twice" | |
# Set the preferred delay between each keypress | |
Start-Sleep -Seconds 10 | |
} | |
################# | |
# MOUSE VERSION # | |
################# | |
#Add-Type -AssemblyName System.Windows.Forms | |
#$position = [System.Windows.Forms.Cursor]::Position | |
#$position.X++ | |
#[System.Windows.Forms.Cursor]::Position = $position | |
#while(1) { | |
# $position = [System.Windows.Forms.Cursor]::Position | |
# $position.X++ | |
# [System.Windows.Forms.Cursor]::Position = $position | |
# $time = Get-Date; | |
# $shorterTimeString = $time.ToString("HH:mm:ss"); | |
# Write-Host $shorterTimeString "Mouse pointer has been moved 1 pixel to the right" | |
#Set your duration between each mouse move | |
# Start-Sleep -Seconds 10 | |
#} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment