Invoke PoweShell Connect-AzureAd command Error

Connect-AzureAd command was found in the module ‘AzureAD’, but the module could not be loaded. for more information run ‘Import-Module AzureAd’

After running Import-Module AzureAd getting error

The current Processor Architecture x86 the module c:\Program FIles\WindowsPowerShell\Modules\AzureAD\2.20.140\AzureAD.psd1’ requires the following architecture amd64

Kindly help to fix this error

Hi @Ramesh_Kola1,

The root cause for this error is that your PowerShell script / Module (AzureAD.psd1) runs only on 64 bit operating system. I am therefore guessing you are running this on a 32-bit operating system.

To avoid reputation, do check this thread in the Microsoft Forum to understand more on the difference between the two (x86 vs amd64) :

Hello Jeevith,

Thanks for your reply.

My Machine is running on 64-bit only, Scripts work fine when launching PowerShell manually.
With UiPath only we are seeing this issue


Hi @Ramesh_Kola1,

I see you are having similar issue as others in the forum. I was not aware that UiPath for some modules chooses to run on 32 bit. I do not know why this occurs.

The only alternative I see is using the Start Process to kick of your script or the one which @Yoichi suggests here :

Got the Solution

“Set-ExecutionPolicy Unrestricted -Scope CurrentUser
$PathToPowerShell64bit = Get-ChildItem -Path $Env:Windir\WinSxS | Where-Object {$_.FullName -match ‘amd64_microsoft-windows-powershell-exe’}
$PowerShell64bitExe = Get-ChildItem -Path $PathToPowerShell64bit.FullName -Filter PowerShell.exe | Select-Object -ExpandProperty FullName
& $PowerShell64bitExe -file ‘Script Path’”

Script Path = C:\Test\Hello64.ps1’

1 Like

Thank you for sharing the solution here.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.