Failing to connect via PowerShell

Чингис Рустемов 1 Reputation point
2022-05-04T12:25:10.057+00:00

Hello

I`m running the following code in PowerShell as an Administrator
PS C:\Windows\system32> Import-Module ExchangeOnlineManagement
PS C:\Windows\system32> Connect-IPPSSession

And received an error: ПРЕДУПРЕЖДЕНИЕ: Ваше подключение перенаправлено на следующий URI:
"https://eur06b.ps.compliance.protection.outlook.com/Powershell-LiveId?BasicAuthToOAuthConversion=true;PSVersion=5.1.19
041.1645"
New-ExoPSSession : Сбой обработки данных, полученных от удаленного сервера
eur06b.ps.compliance.protection.outlook.com. Сообщение об ошибке: The request for the Windows Remote Shell with
ShellId 432FF59F-54E2-412B-A0D6-C9D1A6CD765E failed because the shell was not found on the server. Possible causes
are: the specified ShellId is incorrect or the shell no longer exists on the server. Provide the correct ShellId or
create a new shell and retry the operation. Подробности см. в разделе справки "about_Remote_Troubleshooting".
C:\Program
Files\WindowsPowerShell\Modules\ExchangeOnlineManagement\2.0.5\netFramework\ExchangeOnlineManagement.psm1:475 знак:30

  • ... PSSession = New-ExoPSSession -ExchangeEnvironmentName $ExchangeEnviro ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • CategoryInfo : ResourceUnavailable: (:) [New-ExoPSSession], PSRemotingTransportException
  • FullyQualifiedErrorId : System.Management.Automation.Remoting.PSRemotingDataStructureException,Microsoft.Exchang
    e.Management.ExoPowershellSnapin.NewExoPSSession

198845-eur.png

Please help

P.S. All permissions are provided according to this instruction https://www.youtube.com/watch?v=M2GUQtIOkgk

Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,327 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Kael Yao-MSFT 37,486 Reputation points Microsoft Vendor
    2022-05-05T05:52:35.01+00:00

    Hi @Чингис Рустемов

    According to this link: Connect to Security & Compliance Center PowerShell
    199077-15.png

    The possible cause may be due to changes in your IP address.
    Please have a check if it is the cause in this case, then retry the cmdlet and see if you are able to connect.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Чингис Рустемов 1 Reputation point
    2022-05-11T09:43:51.707+00:00

    Hi

    The cause of problem was in insufficient permissions.
    Thank you.

    But there is an another problem: the session time is not enough to fulfill the operation. how to increase the session time of Connect-IPPSSession and any session?

    0 comments No comments

  3. Kael Yao-MSFT 37,486 Reputation points Microsoft Vendor
    2022-05-12T05:27:58.353+00:00

    Hi,
    If you would like to run scripts for a large number of mailboxes, here are two links which may be helpful:
    Running PowerShell cmdlets for large numbers of users in Office 365
    Updated: Running PowerShell cmdlets for large numbers of users in Office 365