0

I am working on a program for my company that requires an check function on the user's username, which requires the AD module to be installed ONLY when the program is opened. It works fine on my PC, but I am an admin and I run Windows 10. The rest of my environment is Windows 7.

My code:

Import-Module "\\FileServer\common\IT\Powershell\Modules\ActiveDirectory"

The error:

Import-Module: Could not load file or assembly 'file://\\bmh01-fs03\common\IT\Powershell\Modules\ActiveDirectory\Microsoft.ActiveDirectory.Management' or one of its dependencies. The ststem cannot find the file specified.

Is it something within the AD module? And why does it work on my PC and not a users?

2
  • If you don't have the Active Directory module installed on your machine, you need to download the correct Remote Server Administration Tools (RSAT) package for your OS. See: learn.microsoft.com/en-us/powershell/module/addsadministration/… Commented Nov 27, 2018 at 18:08
  • my understanding is that the [adsi] stuff is on win7 systems. it is on mine. if you only need that one user validation test, then the [adsi] calls otta be able to handle the job. Commented Nov 27, 2018 at 18:11

2 Answers 2

2

The ActiveDirectory module is a non redistributable module. It comes as part of the Remote Server Administration Tools (RSAT), which you have to install on the client.

If you want to avoid such dependencies, you can query Active Directory with the [ADSI] provider.

Sign up to request clarification or add additional context in comments.

Comments

1

This actually works fine for me in standard PowerShell (just not PowerShell Core).

Transfer these directories from the server with the RSAT module:

C:\Windows\Microsoft.NET\assembly\GAC_64\Microsoft.ActiveDirectory.Management\v*\Microsoft.ActiveDirectory.Management.dll
C:\Windows\System32\WindowsPowerShell\v1.0\Modules\ActiveDirectory\

And import:

Import-Module "full_path\Microsoft.ActiveDirectory.Management.dll"
Import-Module "full_path\ActiveDirectory.psd1"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.