Reputation: 448
I'm having a really weird issue. I'm unable to import the Azure AD Sync module. Here's what I've tried:
Import-Module ADSync
Import-Module "C:\Program Files\Microsoft Azure AD Sync\Bin\ADSync\ADSync.psd1"
I'm getting the following error:
Import-module : Could not load file or assembly 'file:///C:\Program Files\Microsoft Azure AD Sync\Bin\Microsoft.Azure.ActiveDirectory.Synchronization.ProvisioningWebServiceAdapter.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format. At line:1 char:1 + Import-module adsync + ~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [Import-Module], BadImageFormatException + FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand
I'm running under the following premise:
The account I'm using is a Domain Admin and should have full permissions. I'm RDPing into the server. I'm also running Powershell as an Administrator. I've checked all installations and frameworks and they are either up to date or not applicable. AD sync is running just fine, I'm just trying to get the powershell CMDlets to work so that I can add them to a script I'm writing.
UPDATE: See below answers for solution. Reinstalling AAD was the solution.
Upvotes: 0
Views: 9006
Reputation: 36
For anyone else running into this, I found the issue to be when running the (x86) version of powershell is not compatible with the ADSync module. Check your shortcuts that you're using to open powershell. You can use the command
[Environment]::Is64BitProcess
to check if you're running a 64 bit version of Powershell. If it returns false, ADSync commands won't work.
example of 32 bit powershell being incompatible
Upvotes: 2
Reputation: 972
Was able to import the module using below command, please try it out.
Import-Module –Name "C:\Program Files\Microsoft Azure AD Sync\Bin\ADSync" -Verbose
Additional Documentation Reference for:
Hope this helps.
Upvotes: 1