Jump to content

Recommended Posts

Posted

Not sure whether I should post this here or in the Scripts forum.

 

I'm using PowerShell to manage Office 365 mailboxes. When I first connect, I store the credentials in a $cred variable and I am able to run commands. However, if I try to run a command after the connection has been established for longer than 2 minutes, I am prompted to re-enter my password. The same thing happens after the next two minutes. Even when running a long script that imports values from a CSV file, I am prompted for a password mid-flow.

 

I'm sure I never used to have this problem. What am I doing wrong?

Posted (edited)

Thanks @Steve21. I've looked at that page already and tried setting the -OperationTimeout to 0 when I first connect, but it still asks for a password when I first run a Set-Mailbox script with an imported CSV and again after two minutes.

 

Edit: In the Powershell command line it says "Creating a new session for implicit remoting of Set-Mailbox command..." whenever it prompts for a password.

Edited by StevieM
Posted

The problem appears to be that the Set-Mailbox command runs remotely on the Exchange Online server. Although I have created a PSSession and set OperationTimeout options, PowerShell creates another implicit remote session to run the Set-Mailbox command. It is this implicit session that terminates after two minutes, and I appear to have no control over this implicit session.

 

I MUST be doing something wrong, as it seems crazy to give users the ability to automate tasks... provided they sit and wait to enter their credentials every two minutes.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...