Teams Going “Away” When You’re Just... Away


Anyone who uses Microsoft Teams knows this pain:
Step away for more than 5 minutes, and boom—your status flips to “Away.” Even if you’re just grabbing coffee or reading a doc on your phone.


A Simple PowerShell Script


PowerShell can simulate keyboard activity. So I created a script using AI that “presses” the Shift key every minute—just enough to keep Windows from locking the screen and Teams from marking you as inactive.

And best of all—it runs silently in the background.




















How To Use the Script

  1. Open PowerShell from Start bar (Windows only)

    • Press Windows + R, type powershell, and hit Enter

  2. Copy and paste this code into the PowerShell window:

  3. Press Enter - That’s it. No popups. No output. It just runs silently and keeps you “online.”


Customize It: Set Your Own Duration


Want it to run for 30 minutes instead of 90? Just change this line:

Change 90 to however many minutes you want to stay active.

📬 Made by M365Advisor


We also built M365Advisor — a platform that helps IT teams automate M365 license optimization and save 15–20% on costs. If you're in IT and manage Microsoft 365, definitely check us out for - Free until May 2025.

Questions or want customizations? Feel free to reach out us
📩 info@m365advisor.us

Teams Going “Away” When You’re Just... Away


Anyone who uses Microsoft Teams knows this pain:
Step away for more than 5 minutes, and boom—your status flips to “Away.” Even if you’re just grabbing coffee or reading a doc on your phone.


A Simple PowerShell Script


PowerShell can simulate keyboard activity. So I created a script using AI that “presses” the Shift key every minute—just enough to keep Windows from locking the screen and Teams from marking you as inactive.

And best of all—it runs silently in the background.




















How To Use the Script

  1. Open PowerShell from Start bar (Windows only)

    • Press Windows + R, type powershell, and hit Enter

  2. Copy and paste this code into the PowerShell window:

  3. Press Enter - That’s it. No popups. No output. It just runs silently and keeps you “online.”


Customize It: Set Your Own Duration

Want it to run for 30 minutes instead of 90? Just change this line:



Change 90 to however many minutes you want to stay active.

📬 Made by M365Advisor


We also built M365Advisor — a platform that helps IT teams automate M365 license optimization and save 15–20% on costs. If you're in IT and manage Microsoft 365, definitely check us out for - Free until May 2025.

Questions or want customizations? Feel free to reach out us
📩 info@m365advisor.us

How I Set My Teams Status to DND and Watched a Basketball Game – Without Going “Away”

$duration = 90


Join the Weekly Automation Newsletter

Join the Weekly Automation Newsletter

Join our Weekly Automation newsletter

for more scripts

$duration = 90

$interval = 60

$endTime = (Get-Date).AddMinutes($duration)

Add-Type -AssemblyName System.Windows.Forms

while ((Get-Date) -lt $endTime) {

    [System.Windows.Forms.SendKeys]::SendWait("+")

    Start-Sleep -Seconds $interval

}

Check out M365Advisor:
An intelligent copilot for M365 Administration

Teams Going “Away” When You’re Just... Away


Anyone who uses Microsoft Teams knows this pain:
Step away for more than 5 minutes, and boom—your status flips to “Away.” Even if you’re just grabbing coffee or reading a doc on your phone.


A Simple PowerShell Script


PowerShell can simulate keyboard activity. So I created a script using AI that “presses” the Shift key every minute—just enough to keep Windows from locking the screen and Teams from marking you as inactive.

And best of all—it runs silently in the background.














How To Use the Script

  1. Open PowerShell from Start bar (Windows only)

    • Press Windows + R, type powershell, and hit Enter

  2. Copy and paste this code into the PowerShell window:

  3. Press Enter - That’s it. No popups. No output. It just runs silently and keeps you “online.”


Customize It: Set Your Own Duration

Want it to run for 30 minutes instead of 90? Just change this line:



Change 90 to however many minutes you want to stay active.

📬 Made by M365Advisor


We also built M365Advisor — a platform that helps IT teams automate M365 license optimization and save 15–20% on costs. If you're in IT and manage Microsoft 365, definitely check us out for - Free until May 2025.

Questions or want customizations? Feel free to reach out us
📩 info@m365advisor.us

$duration = 90


$duration = 90

$interval = 60

$endTime = (Get-Date).AddMinutes($duration)

Add-Type -AssemblyName System.Windows.Forms

while ((Get-Date) -lt $endTime) {

    [System.Windows.Forms.SendKeys]::SendWait("+")

    Start-Sleep -Seconds $interval

}