Public/Connection/Test-MicrosoftTeamsConnection.ps1
# Module: Orbit # Function: Testing # Author: David Eberhardt # Updated: 27-MAY 2023 # Status: Live function Test-MicrosoftTeamsConnection { <# .SYNOPSIS Tests whether a valid PS Session exists for MicrosoftTeams .DESCRIPTION A connection established via Connect-MicrosoftTeams is parsed. .EXAMPLE Test-MicrosoftTeamsConnection Will Return $TRUE only if a session is found. .INPUTS System.Void .OUTPUTS System.Boolean .NOTES Calls Get-PsSession to determine whether a Connection to MicrosoftTeams (SkypeOnline) exists .COMPONENT TeamsSession .FUNCTIONALITY Tests the connection to MicrosoftTeams (SkypeOnline) .LINK https://github.com/DEberhardt/Orbit/tree/main/docs/Orbit.Authentication/Test-MicrosoftTeamsConnection.md .LINK https://github.com/DEberhardt/Orbit/tree/main/docs/about/about_TeamsSession.md .LINK https://github.com/DEberhardt/Orbit/tree/main/docs/ #> [CmdletBinding()] [OutputType([Boolean])] param() #param begin { #Write-Verbose -Message "[BEGIN ] $($MyInvocation.MyCommand)" Show-OrbitFunctionStatus -Level Live $Stack = Get-PSCallStack $Called = ($stack.length -ge 3) } #begin process { #Write-Verbose -Message "[PROCESS] $($MyInvocation.MyCommand)" try { $CLI = Get-CsCallingLineIdentity -Identity Global -WarningAction SilentlyContinue -ErrorAction Stop if ( $CLI ) { return $true } else { return $false } } catch { return $false } #> } #process end { #Write-Verbose -Message "[END ] $($MyInvocation.MyCommand)" } #end } # Test-MicrosoftTeamsConnection |