Forum Discussion

RNalivaika's avatar
RNalivaika
Iron Contributor
Sep 11, 2020
Solved

Run Exchange Online Powershell script as background job

Hello Exchange Online and Powershell experts, I have a script that fails to complete because of time-out in session. Therefore, I thought of running it as a background job. I've seen some articles about that, but there they used the old exo ps modules and basic auth. I would like to achieve that using ps module supporting modern auth. Any ideas about that? Best regards - Ruslan

  • The V2 module has some better login and should reconnect sessions automatically (for a time), but other than that not much has changed and you should still follow the same old recommendations.

3 Replies

  • farismalaeb's avatar
    farismalaeb
    Steel Contributor

    RNalivaika 

    If the session time out resulting of inactivity, then you can keep sending from time to time a request to the exchange server and small invocation for the connection to keep the session active.

     

  • The V2 module has some better login and should reconnect sessions automatically (for a time), but other than that not much has changed and you should still follow the same old recommendations.

    • RNalivaika's avatar
      RNalivaika
      Iron Contributor

      Using V2 module in combination with new cmdlets in the script solved the timeout issue.

Resources