Eventual time out of session (suspected) RRS feed

  • Question

  • Hi All

    While running a script I do a connection to SkypeOnline so I can set some policies on potentially thousands of students in a tenant:

    Import-Module SkypeOnlineConnector
        $SfBsession = New-CsOnlineSession -Credential $cred -Verbose -OverrideAdminDomain $MSDomain
        Import-PSSession -Session $SfBsession

    After a while of running the loop successfully setting policies, it starts throwing this:

    Grant-CsTeamsMeetingPolicy -PolicyName Tag:Education_Student -Identity  REDACTED@REDACTED.COM
    Starting a command on the remote server failed with the following error message : The WinRM client cannot process the
    request. The authentication mechanism requested by the client is not supported by the server or unencrypted traffic is
    disabled in the service configuration. Verify the unencrypted traffic setting in the service configuration or specify
    one of the authentication mechanisms supported by the server.  To use Kerberos, specify the computer name as the
    remote destination. Also verify that the client computer and the destination computer are joined to a domain. To use
    Basic, specify the computer name as the remote destination, specify Basic authentication and provide user name and
    password. Possible authentication mechanisms reported by server: For more information, see the
    about_Remote_Troubleshooting Help topic.
        + CategoryInfo          : OperationStopped: (admined2.online.lync.com:String) [], PSRemotingTransportException
        + FullyQualifiedErrorId : JobFailure
        + PSComputerName        : admined2.online.lync.com

    The fact that if you kick it off again it runs for ages says to me it is timing out of the imported PS Session so how do I work around this?  Can I check for session expiry or can I just re-authenticate every 10 minutes, pull in another session and then continue the user list?

    The loop is just this:

    $ALLUsers = Get-MsolUser -All | ?{ $_.isLicensed -eq "TRUE" }
    $ALLUsersApply = $ALLUsers | ?{ ($_.Licenses | ?{ $_.AccountSkuId -eq $LicenseSelection}).Length -gt 0} | select SignInName
    foreach ($User in $ALLUsersApply) {
        write-host "Grant-CsTeamsMessagingPolicy -PolicyName $PolicySelection -Identity " $User.SignInName
        Grant-CsTeamsMessagingPolicy -PolicyName $PolicySelection -Identity $User.SignInName
        write-host "Grant-CsTeamsMeetingPolicy -PolicyName $PolicySelection -Identity " $User.SignInName
        Grant-CsTeamsMeetingPolicy -PolicyName $PolicySelection -Identity $User.SignInName


    Wednesday, June 24, 2020 5:57 PM

All replies

  • Contact Microsoft support after you check to be sure you have the latest MSOnline and SkypeOnlineConnector installed.

    Your issue should be posted in the Skype for Business forum as it is product specific.


    • Edited by jrv Wednesday, June 24, 2020 6:20 PM
    Wednesday, June 24, 2020 6:19 PM
  • Hi,
    Was your issue resolved? 
    If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.
    If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.
    If no, please reply and tell us the current situation in order to provide further help.
    Best Regards,
    Yang Yang

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Friday, July 3, 2020 5:46 AM