Some options based on what permissions your admins allow
Paste the following directly in PowerShell or put into PowerShell ISE then highlight the line and click "Run Selection (F8)" to run even if running scripts is disabled via Execution Policy.
$wsh = New-Object -COMObject WScript.Shell; while (1) {$RND = Get-Random -Minimum 30 -Maximum 120; $wsh.SendKeys('+{F15}'); Write-Host "$(Get-Date)"; Start-Sleep -Seconds $RND}
Does not work in ConstrainedLanguageMode - you can check with: $ExecutionContext.SessionState.LanguageMode
You don't need an F15
key on your physical keyboard for this to work.
Re: https://gist.github.com/jamesfreeman959/231b068c3d1ed6557675f21c0e346a9c
Create a .bat file with the following in it, then just run it:
@if (@a==@a) @end /*
@echo off
set SendKeys=CScript //nologo //E:JScript "%~F0"
set starttime=%TIME%
set startdate=%DATE%
:loop
cls
set /a rng = %RANDOM% * 60 / 32768 + 30
echo Sending [Shift]+[F15]
echo Start: %starttime% %startdate%
echo Latest: %TIME% %DATE%
%SendKeys% "+{F15}"
timeout /t %rng% /nobreak
goto loop
*/
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.SendKeys(WScript.Arguments(0));
This is kind of crazy; it uses JScript conditional compilation inside of a file that can be read as both a .js
and .bat
. It basically does the same thing, sending Shift
+F15
every 30 seconds.