This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Error when running with PowerShell V3

Hello all,

May I know if you have experience the similar issue as me. 

When running in the HPOO, we always got the error as following.

However, the credential was passed, the EXO powershell has already connected as well.  and this issue is randomly occurred. 

May I know if you have any idea on this? 

System.Management.Automation.MethodInvocationException: Exception calling "GetCurrentConnectionContext" with "1" argument(s): "You must call Connect-ExchangeOnline before calling any other cmdlet." ---> System.Exception: You must call Connect-ExchangeOnline before calling any other cmdlet.

   at Microsoft.Exchange.Management.ExoPowershellSnapin.ConnectionContextFactory.GetCurrentConnectionContext(String connectionContextObjectId)

   at CallSite.Target(Closure , CallSite , Type , Object )

   --- End of inner exception stack trace ---

   at System.Management.Automation.ExceptionHandlingOps.ConvertToMethodInvocationException(Exception exception, Type typeToThrow, String methodName, Int32 numArgs, MemberInfo memberInfo)

   at CallSite.Target(Closure , CallSite , Type , Object )

   at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)

   at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame)

   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)

   --- End of inner exception stack trace ---

   at PowerShellV2.PSRunspaceV2.RunCommand[T](PSCommand command)

   at PowerShellV2.PSRunspaceV2.RunCommand(PSCommand command)

   at PowerShellV2.PSRunspaceV2.RunScript(String scriptText)

   at dotNETWebActions_PowerShell.IActions.PowerShellBaseAction.ExecutePowerShell(ActionRequest req, ISession s, IActionRegistry reg);returnCode=1;stdout=

Labels:

RPA