$TeamsStatus=Get-Content-Path"C:\Users\$UserName\AppData\Roaming\Microsoft\Teams\logs.txt"-Tail100|Select-String-Pattern'Setting the taskbar overlay icon - Available','Setting the taskbar overlay icon - Busy','Setting the taskbar overlay icon - Away','Setting the taskbar overlay icon - Do not disturb','Main window is closing','main window closed','Setting the taskbar overlay icon - On the phone','Setting the taskbar overlay icon - In a meeting','StatusIndicatorStateService: Added Busy','StatusIndicatorStateService: Added Available','StatusIndicatorStateService: Added InAMeeting','StatusIndicatorStateService: Added DoNotDisturb'|Select-Object-Last1
ElseIf($TeamsStatus-like"*Setting the taskbar overlay icon - Busy*"-or$TeamsStatus-like"*StatusIndicatorStateService: Added Busy*"-or$TeamsStatus-like"*Setting the taskbar overlay icon - On the phone*"){
ElseIf($TeamsStatus-like"*Setting the taskbar overlay icon - Away*"-or$TeamsStatus-like"*StatusIndicatorStateService: Added Away*"){
$Status="Away"
Write-Host$Status
}
ElseIf($TeamsStatus-like"*Setting the taskbar overlay icon - Do not disturb *"-or$TeamsStatus-like"*StatusIndicatorStateService: Added DoNotDisturb*"){
$Status="Do not disturb"
Write-Host$Status
}
ElseIf($TeamsStatus-like"*Setting the taskbar overlay icon - In a meeting*"-or$TeamsStatus-like"*StatusIndicatorStateService: Added InAMeeting*"){