import-module : the specified module ‘adsync’ was not loaded because no valid module file was found in any module directory.

In this PowerShell Azure tutorial, we will discuss how to fix the error. The specified module ‘ADSync’ was not loaded because no valid module file was found in any module directory. This error I got while running the PowerShell command to import the ADSync module.

import-module : the specified module ‘adsync’ was not loaded because no valid module file was found in any module directory.

Recently, I was trying to run the PowerShell cmdlet to import the ADSync module. Then I got this error.

I was executing the below PowerShell cmdlet to import the ADSync module.

PS C:\WINDOWS\system32> Import-Module ADSync

You can see it here

import-module adsync not found

The exact error message was as below

Import-Module: The specified module ‘ADSync’ was not loaded because no valid module file was
found in any module directory.

At line:1 char:1

  • Import-Module ADSync
  • ~~~~
    • CategoryInfo : ResourceUnavailable: (ADSync: String) [Import-Module], FileNotFoun
      exception
    • FullyQualifiedErrorId: Modules_ModuleNotFound, Microsoft.PowerShell.Commands.ImportModule
      Command

Solution

Now to fix this error, you can follow the below steps.

1. Open the Windows PowerShell or PowerShell ISE and Run as administrator mode

the specified module 'adsync' was not loaded because no valid module file was found in any module directory.

2. The next step is to run the below PowerShell cmdlet to see what modules are available. The ADSync module should be listed in your list of installed modules.

PS C:\WINDOWS\system32> get-Module
import-module adsync

If you have already installed it and are getting the error, you can fix that issue. The ADSync module is not listed. If you have the ADSync module listed after executing the above command, then move to Step 3.

3. Now, the next step is to import the ADSync module using the below PowerShell cmdlet.

Import-Module -Name "C:\Program Files\Microsoft Azure AD Sync\Bin\ADSync" -Verbose
import module adsync

The default installation path for the ADSync module is C:\Program Files\Microsoft Azure AD Sync\Bin\ADSync. Still, you can crosscheck if the path is the same for you before running the above command.

This time, you should get the desired output. It should execute successfully without any issues.

You may like following the tutorials below

Conclusion

Here, in this article, we discussed the fix or the solution for the error. import-module adsync no valid module, which I got while trying to execute the PowerShell cmdlet to import the ADSync module. Hope this helps you to fix your issue !!!

Azure Virtual Machine

DOWNLOAD FREE AZURE VIRTUAL MACHINE PDF

Download our free 25+ page Azure Virtual Machine guide and master cloud deployment today!