使用PowerShell上的skype在线连接器获取用户的Skype状态

问题描述 投票:1回答:1

我正在编写一个小脚本,输出用户当前的Skype for Business状态。

可用,忙碌,请勿打扰。等等

我已经尝试了一下,可以输出很多信息。脚本工作正常,但我找不到状态条目。

到目前为止这是我的代码:

$userCredential = Get-Credential
$sfbSession = New-CsOnlineSession -Credential $userCredential

Import-Module SkypeOnlineConnector
Import-PSSession $sfbSession #connection opens

Get-CsOnlineUser -Identity "[email protected]"

$currentSession = Get-PSSession
Remove-PSSession -Session $currentSession #connection closes

我在错误的地方搜索吗?

如果有更多信息我应该提供,请问,我希望我们能解决这个问题。

powershell azure-active-directory skype-for-business
1个回答
1
投票

对于每个人都在想,我解决了这个问题。我没有使用Skype在线连接器,而是使用Skype Lync 2013 SDK

通过这个简单的代码,我可以实现我想要的。

$client = [Microsoft.Lync.Model.LyncClient]::GetClient()
$contact = $client.ContactManager.GetContactByUri("[email protected]")
$availabilityId = $contact.GetContactInformation("Availability")
$activity = $contact.GetContactInformation("Activity")
Write-Output ([Microsoft.Lync.Model.ContactAvailability]$availabilityId)
© www.soinside.com 2019 - 2024. All rights reserved.