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.
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.
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.
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?
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):
Windows
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:
Windows-Legacy
The strange part is that the module also does not seem available here, but the activity does seem to work in these projects.
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe:
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
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.
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.
Hello,
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.