Large exchange operations from csv to office 365 PS-Session

Welcome Forums General PowerShell Q&A Large exchange operations from csv to office 365 PS-Session

This topic contains 3 replies, has 2 voices, and was last updated by

 
Participant
2 weeks ago.

  • Author
    Posts
  • #174577

    Participant
    Topics: 1
    Replies: 1
    Points: 15
    Rank: Member

    Hello,

    I am trying to create mail-contacts (Organizational contacts) using ps-session on NIE tenant using csv loops, I can create/update some chunks without any issue.

    I have set timeout, execution policy, sleep time etc to overcome this issue, below is the error I receive.

    Basically thread breaks during the process, I cant catch that exception and that breaks ps-session as well, gives pop up for entering creds for office 365 admin account.

    =================================================================================

    Processing data from remote server outlook.office365.com failed with the following error message: WinRM cannot complete the operation. Verify that the specified

    computer name is valid, that the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled and allows access from this

    computer. By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local subnet. For more information, see the

    about_Remote_Troubleshooting Help topic.
    
    + CategoryInfo          : OperationStopped: (outlook.office365.com:String) [], PSRemotingTransportException
    
    + FullyQualifiedErrorId : JobFailure
    
    + PSComputerName        : outlook.office365.com
    
    
    Cannot invoke the pipeline because the runspace is not in the Opened state. Current state of the runspace is 'Broken'.
    
    + CategoryInfo          : OperationStopped: (Microsoft.Power...tHelperRunspace:ExecutionCmdletHelperRunspace) [], InvalidRunspaceStateException
    
    

    Processing data from remote server outlook.office365.com failed with the following error message: WinRM cannot complete the operation. Verify that the specified

    computer name is valid, that the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled and allows access from this

    computer. By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local subnet. For more information, see the

    about_Remote_Troubleshooting Help topic.
    
    + CategoryInfo          : OperationStopped: (outlook.office365.com:String) [], PSRemotingTransportException
    
    + FullyQualifiedErrorId : JobFailure
    
    + PSComputerName        : outlook.office365.com
    
    
    
    Cannot invoke the pipeline because the runspace is not in the Opened state. Current state of the runspace is 'Broken'.
    
    + CategoryInfo          : OperationStopped: (Microsoft.Power...tHelperRunspace:ExecutionCmdletHelperRunspace) [], InvalidRunspaceStateException
    
    + FullyQualifiedErrorId : InvalidSessionState,outlook.office365.com
    
    + FullyQualifiedErrorId : InvalidSessionState,outlook.office365.com
    
  • #174625

    Participant
    Topics: 0
    Replies: 100
    Points: 363
    Helping Hand
    Rank: Contributor

    SneakyPete,

    Are you using Modern Auth module for Exchange Online? How many contacts are you trying to create?

     

    • #174637

      Participant
      Topics: 1
      Replies: 1
      Points: 15
      Rank: Member

      I am using basic auth, and trying to create about 270k mail-contacts.

      But I have split them in to 10 CSV and using 10 different service accounts for those, one CSV file contains about 27k contacts, after processing every 100 contacts I have sleep-timer set, and reset the same connection after every 1000 contacts.. also managing throttling for office 365.

  • #174661

    Participant
    Topics: 0
    Replies: 100
    Points: 363
    Helping Hand
    Rank: Contributor

    270k mail contacts... Wow. That has to be a pain. The session state for Exchange Online with Basic auth should be roughly 2 hours, however I think you are running in to Throttling for Exchange Online instead. I would recommend opening a support case with Microsoft and have them raise  the throttling limit to unlimited while you process this request. They will ask for a business justification and you have one, you need to create 270K mail contacts... I still don't understand why a company would ever need to have 270K Mail contacts in the GAL, but hey that's what you are paid for! 🙂 Let me know if you need any further assistance.

    I would also recommend following this article to help alleviate some of this throttling.

    https://support.microsoft.com/en-us/help/2881759/micro-delay-applied-warning-or-delays-when-you-run-scripts-and-cmdlets

You must be logged in to reply to this topic.