


Consult the logs and documentation for the Service on the destination is running and is accepting requests. New-PSSession : Connecting to remote server failed with theįollowing error message : The client cannot connect to the destination specified in the request. VERBOSE: Discovering PowerShell endpoint URI However, when I try to build the session (verbose): VERBOSE: Determining domain to admin However, I am now trying to do the exact same thing using New-CsOnlineSession rather than New-PSSession (used to connect to o365). I have had no trouble whatsoever connecting to remote exchange. + FullyQualifiedErrorId : ParameterArgumentValidationError,Īm I missing something? I am using the 2.3.1 Teams Module.I am attempting to manage Skype Online for Business via the LyncOnlineConnector PowerShell module. + CategoryInfo : InvalidData: (:), ParentContainsErrorRecordException Session (Get-PSImplicitRemotingSession -CommandName 'Get-CsOnline. Provide an argument that is not null or empty, and then try the command again.Īt C:\Program Files\WindowsPowerShell\Modules\MicrosoftTeams\2.3.1\net472\SfBORemotePowershellModule.psm1:10006 char:38 Invoke-Command : Cannot validate argument on parameter 'Session'. + FullyQualifiedErrorId : UnauthorizedAccessException.GetCsOnlineSession + CategoryInfo : NotSpecified: (:), UnauthorizedAccessException

+ $remoteSession = & (Get-CsOnlineSessionCommand) I get the error Get-CsOnlineSession : Run Connect-MicrosoftTeams before running cmdlets.Īt C:\Program Files\WindowsPowerShell\Modules\MicrosoftTeams\2.3.1\net472\SfBORemotePowershellModule.psm1:63 char:22 However when I try to run an skype command like Get-CsOnlineVoiceUser and i gen run commands like Get-Team and returns the info correctly. Then I run Connect-MicrosoftTeams -AadAccessToken $accessToken -MsAccessToken $token -AccountId $accountĪnd it doesn't throw an error, works properly. $body = Invoke-RestMethod -Method Post -Uri $uri -Body $body $ConnectGraph = Invoke-RestMethod -Uri "$TenatDomainName/oauth2/v2.0/token" -Method POST -Body $Body I did an app registration with the following permissionsĪnd I am authenticating against Azure AD and Graph: #Connect to Graph I want to programatically connecto to Microsoft Teams and execute some skype for businesss online commands.Ĭonnect-MicrosoftTeam and get prompted and import my credentials, it all works perfectly, but i need to this programatically. I am running into an strange issue building a Powershell script.
