Announcement

Collapse
No announcement yet.

[PowerShell] Anti-AFK script for your work

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [PowerShell] Anti-AFK script for your work

    Have you ever been in a situation where you just want to chill and scroll through Instagram, Reddit or Facebook at work, but your silly MS Teams, Skype or whatever switches to Idle status after a few minutes? Here's the solution! This PowerShell script will press the CTRL key every 5 minutes for you and prevents these apps switching your online status.

    Code:
    cls
    Write-Host"Anti-AFK-Script"
    $wshell = New-Object -ComObject wscript.shell;
    $i = 0
    $intervall = 300
    While($True) {
      $i++
      Write-Progress -Activity "Next key hit" -SecondsRemaining ($intervall-$i) -Status " "
      $host.ui.RawUI.WindowTitle = "$($intervall-$i) seconds left..."
      if($i -eq $intervall) {
        $wshell.SendKeys('^')
        $i = 0
      }
      Sleep 1
    }
    Create a new file on your computer, for example "anti-afk.ps1", open it with a text editor and copy&paste the code in. Save the file, rightclick on it and select "Run with PowerShell". Done! :-)
    Note: At the first run, PowerShell might ask you if you really want to execute the script (Windows default security settings...). You should of course select Yes here.
Working...
X