Locally detecting a user’s sign in to Microsoft Teams

A customer wanted to see when/if users were doing their first sign in to MS Teams (on new devices), and if this was against their tenant. Mostly untested but for the world since I couldn’t google it:

function checkTeams(){
    $teamsLogPath = Join-Path $($env:LOCALAPPDATA) "packages\MSTeams_8wekyb3d8bbwe\LocalCache\Microsoft\MSTeams\ecs_request_param.json"
    if((Test-Path $teamsLogPath)){
        $state = Get-Content $teamsLogPath | ConvertFrom-JSON
        if($state -and $state.tenantId -eq "YOUR TENANT GUID"){
            return $true
        }else{
            return $false
        }
    }else{
        return $false
    }    
}
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments