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
}
}