Skip to content

Instantly share code, notes, and snippets.

@DavaGordon
Created March 24, 2025 12:22
Show Gist options
  • Save DavaGordon/6202234d5760d1521edf7fe416a1de3b to your computer and use it in GitHub Desktop.
Save DavaGordon/6202234d5760d1521edf7fe416a1de3b to your computer and use it in GitHub Desktop.
Stop Teams Status Away
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
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment