Author Posts

February 11, 2016 at 8:21 am

i've just noticed some odd behaviour in a gui i've developed, utilizing msonline

on intial gui load users are prompted for credentials to authenticate to 365, and it then connects the msolservice

however after a few hours when the session expires, if you try to utilize any of the 365 functions the entire application crashes.

In script form i would normally just be prompted for credentials again.

but this isn't occuring, i'm trying to wrap my head around how to validate that the connection is still valid and if not how to force for credentials to be asked for again

February 16, 2016 at 1:23 pm

What's your GUI running in?

February 16, 2016 at 3:35 pm

Can you just add try..catch in your code? Something like

get-Mailbox $user
catch [System.Management.Automation.CommandNotFoundException]
#Prompt for credential