|
|
|
@ -45,14 +45,15 @@ If($null -ne $SetStatus){
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Clear the status variable at the start
|
|
|
|
|
$CurrentStatus = ""
|
|
|
|
|
|
|
|
|
|
# Start monitoring the Teams logfile when no parameter is used to run the script
|
|
|
|
|
DO {
|
|
|
|
|
# Get Teams Logfile and last icon overlay status
|
|
|
|
|
$TeamsStatus = Get-Content -Path "C:\Users\$UserName\AppData\Roaming\Microsoft\Teams\logs.txt" -Tail 100 | Select-String -Pattern `
|
|
|
|
|
'Setting the taskbar overlay icon -',`
|
|
|
|
|
'StatusIndicatorStateService: Added',`
|
|
|
|
|
'Main window is closing',`
|
|
|
|
|
'main window closed' | Select-Object -Last 1
|
|
|
|
|
'StatusIndicatorStateService: Added' | Select-Object -Last 1
|
|
|
|
|
# Get Teams Logfile and last app update deamon status
|
|
|
|
|
$TeamsActivity = Get-Content -Path "C:\Users\$UserName\AppData\Roaming\Microsoft\Teams\logs.txt" -Tail 100 | Select-String -Pattern `
|
|
|
|
|
'Resuming daemon App updates',`
|
|
|
|
@ -60,7 +61,11 @@ $TeamsActivity = Get-Content -Path "C:\Users\$UserName\AppData\Roaming\Microsoft
|
|
|
|
|
'SfB:TeamsNoCall',`
|
|
|
|
|
'SfB:TeamsPendingCall',`
|
|
|
|
|
'SfB:TeamsActiveCall' | Select-Object -Last 1
|
|
|
|
|
# Get Teams application process
|
|
|
|
|
$TeamsProcess = Get-Process -Name Teams -ErrorAction SilentlyContinue
|
|
|
|
|
|
|
|
|
|
# Check if Teams is running and start monitoring the log if it is
|
|
|
|
|
If ($null -ne $TeamsProcess) {
|
|
|
|
|
If ($TeamsStatus -like "*Setting the taskbar overlay icon - Available*" -or `
|
|
|
|
|
$TeamsStatus -like "*StatusIndicatorStateService: Added Available*") {
|
|
|
|
|
$Status = "Available"
|
|
|
|
@ -89,7 +94,9 @@ ElseIf ($TeamsStatus -like "*Setting the taskbar overlay icon - In a meeting*" -
|
|
|
|
|
$Status = "In a meeting"
|
|
|
|
|
Write-Host $Status
|
|
|
|
|
}
|
|
|
|
|
ElseIf ($TeamsStatus -like "*ain window*") {
|
|
|
|
|
}
|
|
|
|
|
# Set status to Offline when the Teams application is not running
|
|
|
|
|
Else {
|
|
|
|
|
$Status = "Offline"
|
|
|
|
|
Write-Host $Status
|
|
|
|
|
}
|
|
|
|
|