Why is UiPath using PowerShell x86 and how to change it to use 64-Bit?

Hi guys,

I just had weird behaviour with the Invoke-Powershell Activity. I was then investigating and saw that UIPath uses the x86 Version of PS.
Is there a way to change it so it uses the x64 Version of PS?

I need this cause I have to use MSOnline Module, which is not working with 32 Bit PS.

That is all.


Can you try to use StartProcess activity to call the following, istead of Invoke PowerShell activity?


Or it might be better to create bat file to call ps script using the above exe.


1 Like

Ok I can try this. But then I can’t give a variable from PS back to UIPath? I need to retrieve a json in the PS and then give that JSON to UIpath to further work with it.


If you can output result of powershell script to standard output, Process and ProcessStartInfo class will help you as the following.


I understand you want to use the 64-bit version of Powershell when using “Invoke PowerShell” activity. This is possible when you switch from “Windows Legacy” to “Windows” compatibility.

Please see the below screenshot for reference:

Please follow the steps in How can I change targetFramework back to Windows-legacy? - #7 by grosner to change the compatibility.

Also, please note this option is available from Studio version 2021.10

Let us know if this helped.

1 Like

Can you please share the workflow file. Thanks

Hi, How did you resolve the isuue


I am trying to work use the invoke Power Shell activities from a migrated Windows-legacy to windows project but it’s giving me the below error:
Invoke Power Shell: The ‘Get-ADUser’ command was found in the module ‘ActiveDirectory’, but the module could not be loaded. For more information, run ‘Import-Module ActiveDirectory’.
I believe this is due to a mismatch of architecture, can you advise?

Thank you

Hi @GeraltDieSocke and @maesjasper

Here is another thread which describes why this is happening :


Hello @jeevith,

Many thanks for reaching out to me, I just did some validation on the nuance between Windows-Legacy & Windows. And the invoke powershell activities continue to work in windows-legacy where they have not yet worked before in the Windows projects.

Like you proposed, I validated both locations. The strange part is that in neither of the locations, the ActiveDirectory Module seems to be installed. And when I try to import them, they are instantly removed(might be due to company policy):

C:\Users\YOURUSERNAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Windows PowerShell:
We have both versions installed on this location, both missing the ‘ActiveDirectory’ module:

The strange part is that the module also does not seem available here, but the activity does seem to work in these projects.

Do you have any advice moving forward?

Thank you once again,


You may try this:

Inside your custom script, before operating the AD command an import statement (Import-Module ActiveDirectory) can be placed if the script still does not identify the command. (if it already does, then an import statement is not required.)

An example script has been given below:

Import-Module ActiveDirectory
#The rest of your old code for Get-ADUser

Let us know if this worked.

1 Like

Hello Marian,

I have indeed already tried importing this module for all of the install folders but it seems they are instantly removed after restarting .powershell. This may be due to company policy.

The strange part is that the module does not seem to be available at all. Not when launching from the 32-bit location, nor when launching from the 64-bit location.

So, I do not fully comprehend why it would work for Windows-legacy but not for the Windows projects. As they each display identical installed modules.


For the Windows projects (64bit), we are shipping the UiPath.System.Activities with Microsoft.PowerShell.SDK [7.1.0]. So if in this SDK version, the module is not present, it will not work.


1 Like

You may try for the Windows processes this activity package

1 Like


Thanks again for taking the time to repond to this thread. Do I understand correctly, that the Invoke Powershell simply will not be working in case we are using the ‘Windows’ projects in Studio version 2022.4.4?
I have provided a very basic example .xaml file with the correct package version installed and this still does not work on our devices. While it does work in all of our Windows-Legacy projects on the same devices.

I understand that a similar function can be achieved using the ‘Active Directory Scope’ but this would not solve our problem as we have multiple - more complex - PowerShell scripts incorporated in our RPA Flows and we would like to keep using them as such - using the new ‘Windows’ 64-bit project format.

Thank you for your advice & response,

GetDisplayName.txt (256 Bytes)
Main.xaml (6.0 KB)

I was wondering if you managed to resolve this issue as I’m struggling also with the same situation like yours. Unfortunately, I googled a lot and most of them are struggling with the same situation without a proper fix and even if it was a fix, it was for the x86 like 8-12years also because of the .NET Framework (older version). But I’m curios how we can achieve the same result as Windows-Legacy within Windows 64bit project.


Hi @maesjasper

I think I might have a solution for you. Please see this post:

And please report back if it helped.


I can confirm on my side that is still not working. I created also a new topic regarding this issue with a “dense” analysis about it over here:

You can take this one as a reference is it’s helpful.


1 Like