在 Lync Server 2013 中测试用户状态发布和订阅Testing user presence publishing and subscribing in Lync Server 2013

 

上次修改的主题: 2014-06-05Topic Last Modified: 2014-06-05

验证计划Verification schedule

每天Daily

测试工具Testing tool

Windows PowerShellWindows PowerShell

所需的权限Permissions required

在使用 Lync Server 命令行管理程序本地运行时,用户必须是 RTCUniversalServerAdmins 安全组的成员。When run locally using the Lync Server Management Shell, users must be members of the RTCUniversalServerAdmins security group.

使用 Windows PowerShell 的远程实例运行时,必须为用户分配具有运行 Test-CsPresence cmdlet 的权限的 RBAC 角色。When run using a remote instance of Windows PowerShell, users must be assigned an RBAC role that has permission to run the Test-CsPresence cmdlet. 若要查看可使用此 cmdlet 的所有 RBAC 角色的列表,请从 Windows PowerShell 提示符处运行以下命令:To see a list of all RBAC roles that can use this cmdlet, run the following command from the Windows PowerShell prompt:

Get-CsAdminRole | Where-Object {$_.Cmdlets -match "Test-CsPresence"}

说明Description

Test-CsPresence 用于确定一对测试用户是否可以登录 Lync Server,然后交换状态信息。Test-CsPresence is used to determine whether a pair of test users can log on to Lync Server and then exchange presence information. 为此,此 cmdlet 首先使这两个用户登录系统。To do this, the cmdlet first logs the two users on to the system. 如果登录成功,第一个测试用户随后将要求从第二个用户接收状态信息。If both logons succeed, the first test user then asks to receive presence information from the second user. 第二个用户发布此信息,然后 Test-CsPresence 验证是否信息是否已成功传输到第一个用户。The second user publishes this information, and Test-CsPresence verifies that the information was successfully transmitted to the first user. 在交换状态信息后,这两个测试用户就会从 Lync Server 注销。After the exchange of presence information, the two test users are then logged off from Lync Server.

运行测试Running the test

可以使用一对预配置的测试帐户运行 Test-CsPresence cmdlet (参阅设置用于运行 Lync Server 测试的测试帐户) 或已为其启用 Lync Server 的任意两个用户的帐户。The Test-CsPresence cmdlet can be run using either a pair of preconfigured test accounts (see Setting Up Test Accounts for Running Lync Server Tests) or the accounts of any two users who are enabled for Lync Server. 若要使用测试帐户运行此检查,只需指定要测试的 Lync Server 池的 FQDN 即可。To run this check using test accounts, you just have to specify the FQDN of the Lync Server pool being tested. 例如:For example:

Test-CsPresence -TargetFqdn "atl-cs-001.litwareinc.com"

若要使用实际用户帐户运行此检查,必须为每个帐户 (包含帐户名称和密码) 的对象创建两个 Windows PowerShell 凭据对象。To run this check using actual user accounts, you must create two Windows PowerShell credentials objects (objects that contain the account name and password) for each account. 在调用 CsPresence 时,必须包括这些凭据对象和两个帐户的 SIP 地址:You must then include those credentials objects and the SIP addresses of the two accounts when you call Test-CsPresence:

$credential1 = Get-Credential "litwareinc\kenmyer"
$credential2 = Get-Credential "litwareinc\davidlongmire"
Test-CsPresence -TargetFqdn "atl-cs-001.litwareinc.com" -PublisherSipAddress "sip:kenmyer@litwareinc.com" -PublisherCredential $credential1 -SubscriberSipAddress "sip:davidlongmire@litwareinc.com" -SubscriberCredential $credential2

有关详细信息,请参阅 CsPresence Cmdlet 的帮助文档。For more information, see the Help documentation for the Test-CsPresence cmdlet.

确定成功或失败Determining success or failure

如果指定用户可以交换状态信息,则会收到类似于以下内容的输出,并将 Result 属性标记为 " 成功":If the specified users can exchange presence information, then you'll receive output similar to this, with the Result property marked as Success:

TargetFqdn: atl-cs-001.litwareinc.comTargetFqdn : atl-cs-001.litwareinc.com

结果:成功Result : Success

延迟:00:00:06.3280315Latency : 00:00:06.3280315

误差Error :

诊断Diagnosis :

如果两个用户不能交换状态信息,则结果将显示为 "失败",并且会在 "错误" 和 "诊断" 属性中记录其他信息:If the two users can't exchange presence information, then the Result will be shown as Failure, and additional information will be recorded in the Error and Diagnosis properties:

TargetFqdn: atl-cs-001.litwareinc.comTargetFqdn : atl-cs-001.litwareinc.com

结果:失败Result : Failure

延迟:00:00:00Latency : 00:00:00

错误:未找到404Error : 404, Not Found

诊断: ErrorCode = 4005,Source = atl-cs-001.litwareinc.com,Diagnosis : ErrorCode=4005,Source=atl-cs-001.litwareinc.com,

原因 = 未对 SIP 启用目标 URI 或不为其启用目标 URIReason=Destination URI either not enabled for SIP or does not

尚.exist.

Microsoft DiagnosticHeaderMicrosoft.Rtc.Signaling.DiagnosticHeader

例如,由于至少有两个用户帐户中的一个无效,因此以前的输出表明测试失败:该帐户不存在,或者尚未为 Lync Server 启用该帐户。For example, the previous output states that the test failed because at least one of the two user accounts is not valid: either the account does not exist or it has not been enabled for Lync Server. 您可以通过运行与以下内容类似的命令来验证帐户是否存在,并确定是否为 Lync Server 启用了这些帐户:You can verify that the accounts exist, and determine whether they are enabled for Lync Server, by running a command similar to this:

"sip:kenmyer@litwareinc.com", "sip:davidlongmire@litwareinc.com" | Get-CsUser | Select-Object SipAddress, Enabled

如果 Test-CsPresence 失败,则可能需要重新运行测试,这一次包括 Verbose 参数:If Test-CsPresence fails, then you might want to rerun the test, this time including the Verbose parameter:

Test-CsPresence -TargetFqdn "atl-cs-001.litwareinc.com" -Verbose

包含 Verbose 参数时,Test-CsPresence 将返回其在检查指定用户登录到 Lync Server 的能力时所尝试的每个操作的分步帐户。When the Verbose parameter is included, Test-CsPresence will return a step-by-step account of each action it tried when it checked the ability of the specified user to log on to Lync Server. 例如:For example:

注册请求命中未知Registration Request hit against Unknown

"Register" 活动在 "0.0345791" 秒内完成。'Register' activity completed in '0.0345791' secs.

"SelfSubscribeActivity" 活动已启动。'SelfSubscribeActivity' activity started.

"SelfSubscribeActivity" 活动在 "0.0041174" 秒内完成。'SelfSubscribeActivity' activity completed in '0.0041174' secs.

"SubscribePresence" 活动已启动。'SubscribePresence' activity started.

"SubscribePresence" 活动在 "0.0038764" 秒内完成。'SubscribePresence' activity completed in '0.0038764' secs.

"PublishPresence" 活动已启动。'PublishPresence' activity started.

在25秒内未收到异常 "状态通知"。An exception 'Presence notification is not received within 25 secs.' ruing 工作流 STPresenceWorkflow 执行发生。occurred ruing Workflow Microsoft.Rtc.SyntheticTransactions.Workflows.STPresenceWorkflow execution.

在25秒内未收到状态通知这一事实可能表示网络问题阻止交换信息。The fact that the presence notification was not received within 25 seconds might indicate that network issues are preventing information from being exchanged.

测试可能失败的原因Reasons why the test might have failed

下面是 Test-CsPresence 可能失败的一些常见原因:Here are some common reasons why Test-CsPresence might fail:

  • 您指定了不正确的用户帐户。You specified an incorrect user account. 您可以通过运行与以下内容类似的命令来验证用户帐户是否存在:You can verify that a user account exists by running a command similar to this:

    Get-CsUser "sip:kenmyer@litwareinc.com"
    
  • 用户帐户有效,但当前未对 Lync Server 启用该帐户。The user account is valid, but the account is currently not enabled for Lync Server. 若要验证是否已为 Lync Server 启用用户帐户,请运行与以下内容类似的命令:To verify that a user account is enabled for Lync Server, run a command similar to the following:

    Get-CsUser "sip:kenmyer@litwareinc.com" | Select-Object Enabled
    

    如果 Enabled 属性设置为 False,则表示当前未对 Lync Server 启用用户。If the Enabled property is set to False that means that the user is currently not enabled for Lync Server.