Learning and Sharing
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
No Result
View All Result

How To Stop Teams from Changing from Available to Away Status Automatically

May 29, 2024
in Blog, Microsoft Teams, Powershell
0
ADVERTISEMENT

Table of Contents

Stop Teams from Changing from Available to Away Status

One issue that frequently comes up among my colleagues is the Microsoft Teams status showing ‘Away’ when I’m not, or my PC isn’t locked yet. I’ve tried several solutions, such as setting the status duration to a future date, but to no avail. However, I have found success with a simple PowerShell script, which I’ll share in this blog post.

kjScumiWEZquslXtUqOZkkn6XjI7bWoJzPP6rzh5K56m9mBjHbPIMKYBQJtU

The PowerShell script provides a simple method to maintain your Microsoft Teams status as ‘Available’ while you view work-related materials on your computer, such as training or internal work videos, getting some coffee when working at home, or whatever action keeps you from moving your mouse or typing.

The script

Save the script’s contents below to, for example, D:\scripts\Stop-MicrosoftTeamsAway.ps1.

while ($true) {
    try {
        Get-Process -Name 'ms-teams' -ErrorAction stop | Out-Null
        Write-Host ("{0} - Microsoft Teams is running..." -f $(Get-Date)) -ForegroundColor Green
        $wshell = New-Object -ComObject wscript.shell
        $wshell.sendkeys("{NUMLOCK}{NUMLOCK}")
        Write-Host ("{0} - Pressed NUMLOCK twice and waiting for 60 seconds" -f $(Get-Date)) -ForegroundColor Green
        Start-Sleep -Seconds 60          
    }
    catch {
        Write-Warning ("{0} - Microsoft Teams is not running, sleeping for 15 seconds..." -f $(Get-Date))
        Start-Sleep -Seconds 15
    }
}

How does the script work?

The script will continue to run until you press CTRL-C or close the PowerShell window.

  • It checks if Microsoft Teams is running (The new version, of course) and will press the Num-Lock key twice (To toggle it back to on or off, leaving it like you have it configured).
  • It will wait 60 seconds, press Num-Lock again, wait for 60 seconds, and so on.
  • If Microsoft Teams is not running at that moment, or if you close it for an update, it will wait 15 seconds to see if it’s running again and continue the 60-second Num-Lock loop.

If you want to change the keys being pressed to something else, use this table to use other characters. Using Num-Lock seems to work fine, but it could trigger something in some specific cases.

You can also change the frequency of 60 seconds to any value you like, but to keep Microsoft Teams awake, it must be below 300 seconds because Teams will think you’re away after 5 minutes. (Change the Write-Hosts prompt too).

Running the script

You can save the script’s contents to, for example, D:\scripts\Stop-MicrosoftTeamsAway.ps1 and run it in your PowerShell session. The output will look like this when Microsoft Teams is Active:

. D:\scripts\Stop-MicrosoftTeamsAway.ps1
aiwV371sncWvcxaKSH7diIK2LkyOPF02icZljvTqalH8g1VRx2llTmdxVcP3

When Microsoft Teams is not running, it will look like the below screenshots and return to the output as shown above when Teams is active again:

oW0yf4xzYWgfMraeymZeMkTDDErrFtuhn4yYCfFkX1KX685c54sAWDZoVjA9

Conclusion

To maintain an ‘Available’ status on Microsoft Teams, execute the script from your PowerShell prompt as required, or set it up in your system’s Scheduled Tasks. Ensure its configured to run under your user account for functionality. Administrative privileges, or at minimum the Log on as a batch-job permission, are necessary.

ADVERTISEMENT

Not a reader? Watch this related video tutorial:

5/5 - (1 vote)
Previous Post

How to Start Windows Sandbox with Parameters Using PowerShell

Next Post

How to Delete Files Older Than a Specified Number of Days Using PowerShell

Related Posts

Running Hyper-V and VMware Workstation on The Same Machine

August 15, 2024

How to Uninstall All Autodesk Products At Once Silently

July 29, 2024
Ftr5

How to Uninstall the Autodesk Genuine Service on Windows

July 29, 2024
Ftr19

How to Fix Windows Cannot Read the ProductKey From the Unattend Answer File in VirtualBox

July 26, 2024
Ftr25

How to Update Windows Terminal in Windows 10/11

July 26, 2024

How to Disable The Beep Sound in WSL Terminal on Windows

July 26, 2024

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • How To Turn On uBlock Origin Extension in Chrome (2025)
  • Images Hidden Due To Mature Content Settings In CivitAI
  • Azure OpenAI vs Azure AI Hub, How to Choose the Right One for Your Needs

Categories

Stay in Touch

Discord Server

Join the Discord server with the site members for all questions and discussions.

Telegram Community

Jump in Telegram server. Ask questions and discuss everything with the site members.

Youtube Channel

Watch more videos, learning and sharing with Leo ❤❤❤. Sharing to be better.

Newsletter

Join the movement and receive our weekly Tech related newsletter. It’s Free.

General

Microsoft Windows

Microsoft Office

VMware

VirtualBox

Technology

PowerShell

Microsoft 365

Microsoft Teams

Email Servers

Copyright 2025 © All rights Reserved. Design by Leo with ❤

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory