Extend Idle Timeout for Exchange Online Powershell Module

Brian Dougherty 1 Reputation point
2020-12-11T15:15:36.63+00:00

Good Morning,

We are currently using Exchange online powershell module as a shortcut on my desktop.
When I launch the shortcut, it opens to a Powershell window, then I type in Connect-EXOPSSession and login, then it connects me to the Exchange Online.
Problem is that when I am running a script that takes a while to complete, the session will time out after 15 minutes.
Get-IPSSession shows the timeout is 900000 milliseconds/15 minutes.

I looked at the below article, but I am not putting in the variables in manually.

https://social.msdn.microsoft.com/Forums/en-US/a5eae821-bed2-4cb1-8965-ff09261312c9/increase-online-powershell-module-session-time?forum=onlineservicesexchange

Is there a way to change this somewhere?
Tried Connect-EXOPSSession -UserPrincipalName (LoginName) -IdleTimeout, but that errored out.

Looks like all the variables are being run and configured from a powershell file.
that is attached to this question as a text file47492-createexopssession.txt

If I can either extend that IdleTimeout to hours or just to 0 that would be immensely helpful.

Thank You

Brian Dougherty

Exchange Online
Exchange Online
A Microsoft email and calendaring hosted service.
6,171 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Lydia Zhou - MSFT 2,386 Reputation points Microsoft Employee
    2020-12-14T03:11:52.803+00:00

    @Brian Dougherty

    Based on my knowledge, IdleTimeout works for New-PSSessionOption cmdlet. You can try to use the parameter -PSSessionOption with the configuration:

    New-PSSessionOption -IdleTimeout "a value in milliseconds"  
    

    If if still doesn't work, you can use EXO V2 module and the following command to connect:

    Connect-ExchangeOnline -PSSessionOption IdleTimeout <value> -UserPrincipalName <upn> -ShowProgress $true  
    

    Please check this for more details: Connect to Exchange Online PowerShell.


    If the response is helpful, please click "Accept Answer" and upvote it.
    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. ScottGarrett-8267 1 Reputation point
    2022-02-16T16:54:52.117+00:00

    Just in case this helps someone

    $pso = new-PSSessionOption -IdleTimeout 43200000 
    Connect-ExchangeOnline -UserPrincipalName <upn> -PSSessionOption $pso
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.