|
|
@ -38,7 +38,7 @@ If($null -ne $SetStatus){
|
|
|
|
$params = @{
|
|
|
|
$params = @{
|
|
|
|
"state"="$SetStatus";
|
|
|
|
"state"="$SetStatus";
|
|
|
|
"attributes"= @{
|
|
|
|
"attributes"= @{
|
|
|
|
"friendly_name"="Microsoft Teams status";
|
|
|
|
"friendly_name"="$entityStatusName";
|
|
|
|
"icon"="mdi:microsoft-teams";
|
|
|
|
"icon"="mdi:microsoft-teams";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -55,7 +55,7 @@ Function publishOnlineState ()
|
|
|
|
$params = @{
|
|
|
|
$params = @{
|
|
|
|
"state"="updating";
|
|
|
|
"state"="updating";
|
|
|
|
"attributes"= @{
|
|
|
|
"attributes"= @{
|
|
|
|
"friendly_name"="Microsoft Teams monitoring";
|
|
|
|
"friendly_name"="$entityHeartbeatName";
|
|
|
|
"icon"="$iconMonitoring";
|
|
|
|
"icon"="$iconMonitoring";
|
|
|
|
"device_class"="connectivity";
|
|
|
|
"device_class"="connectivity";
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -67,7 +67,7 @@ Function publishOnlineState ()
|
|
|
|
$params = @{
|
|
|
|
$params = @{
|
|
|
|
"state"="on";
|
|
|
|
"state"="on";
|
|
|
|
"attributes"= @{
|
|
|
|
"attributes"= @{
|
|
|
|
"friendly_name"="Microsoft Teams monitoring";
|
|
|
|
"friendly_name"="$entityHeartbeatName";
|
|
|
|
"icon"="$iconMonitoring";
|
|
|
|
"icon"="$iconMonitoring";
|
|
|
|
"device_class"="connectivity";
|
|
|
|
"device_class"="connectivity";
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -88,7 +88,7 @@ publishOnlineState
|
|
|
|
|
|
|
|
|
|
|
|
# Start monitoring the Teams logfile when no parameter is used to run the script
|
|
|
|
# Start monitoring the Teams logfile when no parameter is used to run the script
|
|
|
|
DO {
|
|
|
|
DO {
|
|
|
|
# Set the Windows Service heartbeat sensor every 2 minutes and restart the stopwatch
|
|
|
|
# Set the Windows Service heartbeat sensor every 5 minutes and restart the stopwatch
|
|
|
|
If ([int]$stopwatch.Elapsed.Minutes -ge 4){
|
|
|
|
If ([int]$stopwatch.Elapsed.Minutes -ge 4){
|
|
|
|
$stopwatch.Restart()
|
|
|
|
$stopwatch.Restart()
|
|
|
|
publishOnlineState
|
|
|
|
publishOnlineState
|
|
|
@ -98,13 +98,16 @@ If ([int]$stopwatch.Elapsed.Minutes -ge 4){
|
|
|
|
$TeamsStatus = Get-Content -Path "C:\Users\$UserName\AppData\Roaming\Microsoft\Teams\logs.txt" -Tail 200 | Select-String -Pattern `
|
|
|
|
$TeamsStatus = Get-Content -Path "C:\Users\$UserName\AppData\Roaming\Microsoft\Teams\logs.txt" -Tail 200 | Select-String -Pattern `
|
|
|
|
'Setting the taskbar overlay icon -',`
|
|
|
|
'Setting the taskbar overlay icon -',`
|
|
|
|
'StatusIndicatorStateService: Added' | Select-Object -Last 1
|
|
|
|
'StatusIndicatorStateService: Added' | Select-Object -Last 1
|
|
|
|
|
|
|
|
Write-Host $TeamsStatus
|
|
|
|
# Get Teams Logfile and last app update deamon status
|
|
|
|
# Get Teams Logfile and last app update deamon status
|
|
|
|
$TeamsActivity = Get-Content -Path "C:\Users\$UserName\AppData\Roaming\Microsoft\Teams\logs.txt" -Tail 200 | Select-String -Pattern `
|
|
|
|
$TeamsActivity = Get-Content -Path "C:\Users\$UserName\AppData\Roaming\Microsoft\Teams\logs.txt" -Tail 200 | Select-String -Pattern `
|
|
|
|
'Resuming daemon App updates',`
|
|
|
|
'Resuming daemon App updates',`
|
|
|
|
'Pausing daemon App updates',`
|
|
|
|
'Pausing daemon App updates',`
|
|
|
|
'SfB:TeamsNoCall',`
|
|
|
|
'SfB:TeamsNoCall',`
|
|
|
|
'SfB:TeamsPendingCall',`
|
|
|
|
'SfB:TeamsPendingCall',`
|
|
|
|
'SfB:TeamsActiveCall' | Select-Object -Last 1
|
|
|
|
'SfB:TeamsActiveCall',`
|
|
|
|
|
|
|
|
'StatusIndicatorStateService: Added' | Select-Object -Last 1
|
|
|
|
|
|
|
|
Write-Host $TeamsActivity
|
|
|
|
# Get Teams application process
|
|
|
|
# Get Teams application process
|
|
|
|
$TeamsProcess = Get-Process -Name Teams -ErrorAction SilentlyContinue
|
|
|
|
$TeamsProcess = Get-Process -Name Teams -ErrorAction SilentlyContinue
|
|
|
|
|
|
|
|
|
|
|
@ -133,12 +136,20 @@ If ($null -ne $TeamsProcess) {
|
|
|
|
Write-Host $Status
|
|
|
|
Write-Host $Status
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ElseIf ($TeamsStatus -like "*Setting the taskbar overlay icon - $lgDoNotDisturb *" -or `
|
|
|
|
ElseIf ($TeamsStatus -like "*Setting the taskbar overlay icon - $lgDoNotDisturb *" -or `
|
|
|
|
$TeamsStatus -like "*StatusIndicatorStateService: Added DoNotDisturb*" -or `
|
|
|
|
$TeamsStatus -like "*StatusIndicatorStateService: Added DoNotDisturb*") {
|
|
|
|
$TeamsStatus -like "*Setting the taskbar overlay icon - $lgFocusing*" -or `
|
|
|
|
|
|
|
|
$TeamsStatus -like "*StatusIndicatorStateService: Added Focusing*") {
|
|
|
|
|
|
|
|
$Status = $lgDoNotDisturb
|
|
|
|
$Status = $lgDoNotDisturb
|
|
|
|
Write-Host $Status
|
|
|
|
Write-Host $Status
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ElseIf ($TeamsStatus -like "*Setting the taskbar overlay icon - $lgFocusing*" -or `
|
|
|
|
|
|
|
|
$TeamsStatus -like "*StatusIndicatorStateService: Added Focusing*") {
|
|
|
|
|
|
|
|
$Status = $lgFocusing
|
|
|
|
|
|
|
|
Write-Host $Status
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ElseIf ($TeamsStatus -like "*Setting the taskbar overlay icon - $lgPresenting*" -or `
|
|
|
|
|
|
|
|
$TeamsStatus -like "*StatusIndicatorStateService: Added Presenting*") {
|
|
|
|
|
|
|
|
$Status = $lgPresenting
|
|
|
|
|
|
|
|
Write-Host $Status
|
|
|
|
|
|
|
|
}
|
|
|
|
ElseIf ($TeamsStatus -like "*Setting the taskbar overlay icon - $lgInAMeeting*" -or `
|
|
|
|
ElseIf ($TeamsStatus -like "*Setting the taskbar overlay icon - $lgInAMeeting*" -or `
|
|
|
|
$TeamsStatus -like "*StatusIndicatorStateService: Added InAMeeting*") {
|
|
|
|
$TeamsStatus -like "*StatusIndicatorStateService: Added InAMeeting*") {
|
|
|
|
$Status = $lgInAMeeting
|
|
|
|
$Status = $lgInAMeeting
|
|
|
@ -152,15 +163,25 @@ If ($null -ne $TeamsProcess) {
|
|
|
|
|
|
|
|
|
|
|
|
If ($TeamsActivity -like "*Resuming daemon App updates*" -or `
|
|
|
|
If ($TeamsActivity -like "*Resuming daemon App updates*" -or `
|
|
|
|
$TeamsActivity -like "*SfB:TeamsNoCall*" -or `
|
|
|
|
$TeamsActivity -like "*SfB:TeamsNoCall*" -or `
|
|
|
|
$TeamsStatus -like "*current state: OnThePhone -> *") {
|
|
|
|
$TeamsActivity -like "*OnThePhone -> $lgAvailable*"-or `
|
|
|
|
|
|
|
|
$TeamsActivity -like "*OnThePhone -> $lgBusy*"-or `
|
|
|
|
|
|
|
|
$TeamsActivity -like "*OnThePhone -> $lgInAMeeting*"-or `
|
|
|
|
|
|
|
|
$TeamsActivity -like "*OnThePhone -> $lgFocusing*"-or `
|
|
|
|
|
|
|
|
$TeamsActivity -like "*OnThePhone -> $lgDoNotDisturb*" -or `
|
|
|
|
|
|
|
|
$TeamsActivity -like "*OnThePhone -> Available*"-or `
|
|
|
|
|
|
|
|
$TeamsActivity -like "*OnThePhone -> Busy*"-or `
|
|
|
|
|
|
|
|
$TeamsActivity -like "*OnThePhone -> InAMeeting*"-or `
|
|
|
|
|
|
|
|
$TeamsActivity -like "*OnThePhone -> Focusing*"-or `
|
|
|
|
|
|
|
|
$TeamsActivity -like "*OnThePhone -> DoNotDisturb*") {
|
|
|
|
$Activity = $lgNotInACall
|
|
|
|
$Activity = $lgNotInACall
|
|
|
|
$ActivityIcon = $iconNotInACall
|
|
|
|
$ActivityIcon = $iconNotInACall
|
|
|
|
Write-Host $Activity
|
|
|
|
Write-Host $Activity
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ElseIf ($TeamsActivity -like "*Pausing daemon App updates*" -or `
|
|
|
|
ElseIf ($TeamsActivity -like "*Pausing daemon App updates*" -or `
|
|
|
|
$TeamsActivity -like "*SfB:TeamsActiveCall*" -or `
|
|
|
|
$TeamsActivity -like "*SfB:TeamsActiveCall*" -or `
|
|
|
|
$TeamsStatus -like "*Setting the taskbar overlay icon - $lgOnThePhone*" -or `
|
|
|
|
$TeamsActivity -like "*Setting the taskbar overlay icon - $lgOnThePhone*" -or `
|
|
|
|
$TeamsStatus -like "*StatusIndicatorStateService: Added OnThePhone*") {
|
|
|
|
$TeamsActivity -like "*StatusIndicatorStateService: Added OnThePhone*" -or `
|
|
|
|
|
|
|
|
$TeamsActivity -like "*-> OnThePhone*") {
|
|
|
|
$Activity = $lgInACall
|
|
|
|
$Activity = $lgInACall
|
|
|
|
$ActivityIcon = $iconInACall
|
|
|
|
$ActivityIcon = $iconInACall
|
|
|
|
Write-Host $Activity
|
|
|
|
Write-Host $Activity
|
|
|
@ -182,7 +203,7 @@ If ($CurrentStatus -ne $Status) {
|
|
|
|
$params = @{
|
|
|
|
$params = @{
|
|
|
|
"state"="$CurrentStatus";
|
|
|
|
"state"="$CurrentStatus";
|
|
|
|
"attributes"= @{
|
|
|
|
"attributes"= @{
|
|
|
|
"friendly_name"="Microsoft Teams status";
|
|
|
|
"friendly_name"="$entityStatusName";
|
|
|
|
"icon"="mdi:microsoft-teams";
|
|
|
|
"icon"="mdi:microsoft-teams";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -197,7 +218,7 @@ If ($CurrentActivity -ne $Activity) {
|
|
|
|
$params = @{
|
|
|
|
$params = @{
|
|
|
|
"state"="$Activity";
|
|
|
|
"state"="$Activity";
|
|
|
|
"attributes"= @{
|
|
|
|
"attributes"= @{
|
|
|
|
"friendly_name"="Microsoft Teams activity";
|
|
|
|
"friendly_name"="$entityActivityName";
|
|
|
|
"icon"="$ActivityIcon";
|
|
|
|
"icon"="$ActivityIcon";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|