Created
August 8, 2022 19:57
-
-
Save bradmartin333/37bfd2ecf45ab40da9046032360280fc to your computer and use it in GitHub Desktop.
Needlessly complicated way to keep screen awake
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
$count = [Enum]::GetValues([System.ConsoleColor]).Count | |
$WShell = New-Object -Com "Wscript.Shell" | |
$idx = 1 | |
while (1) | |
{ | |
$WShell.SendKeys("a") | |
Write-Host ([string]::Format(“No sleeping! {0}”,$idx)) -f ([System.ConsoleColor](Get-Random -Minimum 1 -Maximum $count)).value__ | |
$idx++ | |
sleep 60 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment