Invoke Powershell not solving bug after update to 2023.12 and introducing a new one


Due to lack of activity/response/attention in the previous thread used for this (Invoke Powershell is not working - Help / Activities - UiPath Community Forum) or via the support ticket system, I’m opening this bug report here also.

On 2023/12/21 an update to the UiPath.System.Activities package (v23.12.0-preview) showed up, so I installed it, hoping it would solve the problems mentioned in the link above.

Now there’s 3 options available there for “Execution Mode” (sic):

  • “PowerShell 5.1 (32-bit)”
  • “PowerShell 5.1 (64-bit)”
  • “PowerShell 7.2.15 (64-bit)"

Using either of the 1st ones don’t oblige me to reinstall the dependencies I already installed via the system’s PowerShell, as it’s using the same PowerShell binary/install.

The problem is that the main problem reported before stills the same, as the context/session is not being kept amongst different calls to this activity. For instance, you run the


command in one activity; then one or two activities below you run whatever other command from the same package, that needed to be authenticated before with the above command, and then it keeps complaining that

“You must call the Connect-MicrosoftTeams cmdlet before calling any other cmdlets”

The session/context is lost after each call to Invoke Power Shell, thus rendering it unusable.

Plus the activity doesn’t accept relative paths anymore as the path for .ps1 scripts, so it’s going to break further functionality with existing projects.


I’m waiting to try 2023.12 on enterprise studio,
I’m gonna follow this thread following my last topic:

Invoke power shell issue, want to map network drive with credentials - Help / Activities - UiPath Community Forum

We are waiting this issue to be solved to implement dynamic network drive mapping in our company, was initially told that will be solved in 2023.10 and then 2023.12

Hi @pere

Thank you for making a new topic to focus on this issue.

We investigated it further. Currently, it looks like it doesn’t seem likely for us to be able to fix this due to some technical limitations. Windows projects require us to approach PowerShell in a specific way that is different from legacy projects, and this, combined with the fact that the specific MicrosoftTeams module is quite special itself makes it difficult.

But, just to deplete every possible avenue here - I have a small ask. Due to us not being able to get the expected scenario to work, not even in Legacy projects, we would need a working Legacy project sample.
Would you be able to provide such a sample?

By expected scenario I mean a simple project with two Invoke PowerShell activities, one doing just the Connect-MicrosoftTeams and the other anything else, such as a simple Get-AssociatedTeam, and legacy project being able to execute the second activity based on the context from the previous activity.

I don’t think the MicrosoftTeams module is that “special” at all. A lot other ones need authentication; I’m sure a lot other users are gonna experience the same problem.

You can use this one as a base for your testing; of course you’ll need to fill and provide the missing data, like users, passwords and so on:

CreateTeamClassicForUiPath.7z (1.2 MB)