August 26, 2014 at 1:17 pm #718
When trying to import a module into PowerShell you get:
Import-Module : The current processor architecture is: X86. The module ‘xxx.psd1’ requires the following architecture:
This is because the module requires you to run the x64 bit version of PowerShell. To fix this, close PowerShell and open the version of PowerShell that doesn’t have (x86) at the end of it’s name, then try to import the module again.
April 27, 2018 at 3:05 am #2359
What if the PowerShell is running in a .Net System.Managment.Automation.PowerShell object? That is, it is only indirectly PowerShell, not the console or ise. Any guidance helpful
April 27, 2018 at 7:26 am #2360
Is this some c# code you’re writing or something?
I’m not much of a programmer, but maybe you could look up compiler options for Amd64 architecture, or see if there’s a 64bit object you can create and use? Or perhaps you can call the ise and run it through that?
I’d love to know what you are trying to achieve 😀
April 27, 2018 at 9:14 am #2361
I am trying to get a web page (an Azure web app) to invite a (guest) user to my Azure Active directory. I know there is the Microsoft Graph API to wrestle with but I was hoping for building on something I knew worked. The architecture error may have to do with my personal computer because it goes away when I publish the web site project and run it ‘in the cloud’; there I get ‘the AzureAD module can’t be found’ and similar failure of the two AzureAD cmdlets I show below so I am now digging around on how Azure web apps find PowerShell modules … it is always something (e.g., the web app needed to Import-AzureRM.Profile instead of Import-AzureRM for the Login-AzureRMAccount cmdlet to work but, alas, no similar find yet for the AzureAD module in an Azure web app)
But if you can help me clear up my local issue for dev & test, that would helpful. This script works great from PowerShell or running the script from the command-line:
$u = ‘Azure UID’;
$p = ConvertTo-SecureString -AsPlainText ‘Azure Password’ -Force;
$cred = New-Object -TypeName System.Management.Automation.PSCredential `
-ArgumentList $u, $p;
Login-AzureRmAccount -Credential $cred;
Connect-AzureAD -Credential $cred;
$ADGuest = New-AzureADMSInvitation -SendInvitationMessage $true `
-InviteRedirectUrl ‘Landing page when they accept invite’ `
-InvitedUserDisplayName ‘Their name’ `
-InvitedUserEmailAddress ‘Their email’;
but when I try to run this script using the following C# code (note that psSendInvite key in AppSettings has as its value the PowerShell Script and the PowerShell object is in System.Management.Automation)
PowerShell ps = PowerShell.Create();
I get four results in the error stream
The current processor architecture is: X86. The module ‘C:\Program Files\WindowsPowerShell\Modules\AzureAD\18.104.22.168\AzureAD.psd1’ requires the following architecture: Amd64.
Exception has been thrown by the target of an invocation.
The term ‘Connect-AzureAD’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
The term ‘New-AzureADMSInvitation’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
I found a web page suggesting that changing a line in the referenced AzureAD.psd1 would help (e.g., see https://stackoverflow.com/questions/24009803/error-running-powershell-script-from-c-sharp) but that fouled up my build in Visual Studio (my guess is some checksum went wrong with that change).
So a bit long but ironing this out would be very productive for some of my plans; thanks for taking a look!
You must be logged in to reply to this topic.