Import module activedirectory не был загружен windows 10

I have an SSIS job that executes a powershell module that's attempting to pull information from Active Directory. However, when I run the script I get this error: The specified module ActiveDir...

I have an SSIS job that executes a powershell module that’s attempting to pull information from Active Directory. However, when I run the script I get this error:

The specified module ActiveDirectory was not loaded because no valid
module file was found in any module directory

I found this similar question, however they are using Windows Server 2008, whereas I am using Windows Server 2016. I tried to follow the instructions in the question, but I wasn’t able to locate neither «Remote Server Administration Tools» nor «Active Directory module for Windows Powershell.»

asked Sep 21, 2018 at 14:35

DForck42's user avatar

4

Can you check whether Active Directory Web Services service is running under services?

If not start it and run below command

Get-module -list

You can check whether Active Directory module is listed down.

Run below command to Enable Active Directory module

Add-WindowsFeature RSAT-AD-PowerShell

answered Sep 21, 2018 at 14:49

Anurag Gawande's user avatar

7

I have an SSIS job that executes a powershell module that’s attempting to pull information from Active Directory. However, when I run the script I get this error:

The specified module ActiveDirectory was not loaded because no valid
module file was found in any module directory

I found this similar question, however they are using Windows Server 2008, whereas I am using Windows Server 2016. I tried to follow the instructions in the question, but I wasn’t able to locate neither «Remote Server Administration Tools» nor «Active Directory module for Windows Powershell.»

asked Sep 21, 2018 at 14:35

DForck42's user avatar

4

Can you check whether Active Directory Web Services service is running under services?

If not start it and run below command

Get-module -list

You can check whether Active Directory module is listed down.

Run below command to Enable Active Directory module

Add-WindowsFeature RSAT-AD-PowerShell

answered Sep 21, 2018 at 14:49

Anurag Gawande's user avatar

7

In this PowerShell azure tutorial, we will discuss how to fix the error, The specified module ‘ActiveDirectory’ was not loaded that comes while trying to import the ActiveDirectory module using Azure PowerShell cmdlet.

Table of Contents

  • The specified module ‘ActiveDirectory’ was not loaded
  • Import-Module: The specified module ‘ActiveDirectory’ was not loaded because no valid module file was found in any module directory
  • The specified module ‘ActiveDirectory’ was not loaded [Solved]
  • Import-Module: The specified module ‘ActiveDirectory’ was not loaded because no valid module file was found in any module directory [Solved]
    • Solution -1:
    • Solution -2:
  • install-module ActiveDirectory
  • import-module activedirectory not found server 2012 r2
  • Wrapping Up

Recently, while working with Azure PowerShell, I was trying to import the Active Directory module, I got the error “The specified module ‘ActiveDirectory’ was not loaded”. I was executing the below PowerShell cmdlet.

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

  • How To Install Azure PowerShell
  • The term ‘Get-ADSyncScheduler’ is not recognized
PS C:WINDOWSsystem32> Import-Module ActiveDirectory

You can able to see, once I ran the above PowerShell cmdlet, I got the above error The specified module ‘ActiveDirectory’ was not loaded

The specified module ActiveDirectory was not loaded
ActiveDirectory was not loaded

The complete error message was as below

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

At line:1 char:1

  • Import-Module ActiveDirectory
  • ~~~~~~~~~
    • CategoryInfo : ResourceUnavailable: (ActiveDirectory:String) [Import-M
      odule], FileNotFoundException
    • FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.Im
      portModuleCommand

The specified module ‘ActiveDirectory’ was not loaded [Solved]

You can follow the below steps to fix the error The specified module ‘ActiveDirectory’ was not loaded.

Import-Module: The specified module ‘ActiveDirectory’ was not loaded because no valid module file was found in any module directory [Solved]

Solution -1:

Step-1: Run the Windows PowerShell or PowerShell ISE as “Run as administrator” mode.

 'ActiveDirectory' was not loaded

Step-2: Check if the Active Directory Web Services is running on your machine. If it is stopped, you need to start it. You need to search for services.msc to find the Active Directory Web Services status.

Step-3: Now, run the below command to check out if the Active Directory module is present on your machine.

PS C:WINDOWSsystem32> Get-module -list

Step-4: Then, You can use the below PowerShell cmdlet to enable Active Directory module.

PS C:WINDOWSsystem32> Add-WindowsFeature RSAT-AD-PowerShell

Solution -2:

You can also try out the below steps to install the Azure Active Directory module which will fix this issue

  1. Navigate to the Control Panel and open it -> click on the Programs and Features -> Turn On/Off Windows Features
  2. Then you need to find out “Remote Server Administration Tools” and expand it.
  3. Now, Expand the “Role Administration Tools” node.
  4. Then, Expand AD DS and AD LDS Tools option.
  5. Make sure to tick the checkbox for Active Directory Module for Windows Powershell option
  6. Finally, click on the OK button to confirm the installation.

Now, you can run the Import command to import the Azure Active Directory module.

install-module ActiveDirectory

You can refer to the Solution-1 to install the ActiveDirectory module using PowerShell cmdlet.

import-module activedirectory not found server 2012 r2

If you are using Windows server 2012 R2 and you are trying to install the ActiveDirectory module but you are not able to then you can follow the below information to install the active directory module.

Step-1: Run the Windows PowerShell or PowerShell ISE as “Run as administrator” mode.

 'ActiveDirectory' was not loaded

Step-2: Then, run the below PowerShell cmdlet.

Import-Module ServerManager
Add-WindowsFeature RSAT-AD-PowerShell

You may also like to follow the below article

  • The Specified Module ‘AzureRM’ Was Not Loaded
  • How To Create Azure IoT Hub Using PowerShell
  • The term ‘get-azuresubscription’ is not recognized
  • CS1061 C# ‘HttpRequest’ does not contain a definition for ‘Content’ and no accessible extension method ‘Content’ accepting a first argument of type ‘HttpRequest’ could be found
  • The ‘Set-AzContext’ command was found in the module ‘Az.Accounts’ but the module could not be loaded.

Wrapping Up

Well, in this article, we have discussed how to fix the error The specified module ‘ActiveDirectory’ was not loaded.

The above solution will also fix the below issues

  • The specified module ActiveDirectory was not loaded
  • Import-Module: The specified module ‘ActiveDirectory’ was not loaded because no valid module file was found in any module directory
  • The specified module ‘ActiveDirectory’ was not loaded
  • import-module activedirectory was not loaded windows 10
  • import-module activedirectory not found windows 7

Hope it will help you to fix your issue as well !!!

  • Remove From My Forums
  • Question

  • Hi-

    In-place upgrade of Win10 1607 to 1703 and seems to have broke loading ActiveDirectory module. 

    Get below when attempting to import the module:

    Microsoft.ActiveDirectory.Management' or one of its dependencies. Access is denied.

    Works fine and loads other modules listed in my profile:

    powershell.exe -ImportSystemModules

    Found posts suggesting reinstall old v1607 RSAT snapin, but doesn’t fix

    https://www.handheldgroup.com/support-rugged-computers/knowledgebase-KB/22996/

    Running:

    Name                           Value                                                                                                                                  
    ----                           -----                                                                                                                                  
    PSVersion                      5.1.15063.608                                                                                                                          
    PSEdition                      Desktop                                                                                                                                
    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                
    BuildVersion                   10.0.15063.608                                                                                                                         
    CLRVersion                     4.0.30319.42000                                                                                                                        
    WSManStackVersion              3.0                                                                                                                                    
    PSRemotingProtocolVersion      2.3                                                                                                                                    
    SerializationVersion           1.1.0.1 

    Thanks much!

    • Edited by

      Wednesday, October 4, 2017 3:57 PM

Answers

  • The issue can occur but very few people have ever had it happen.

    You can call MS support for help.  If it is related to an update then the call is free.

    You should first try a repair on the Net framework.


    _(ツ)_/

    • Marked as answer by
      djeinck
      Wednesday, October 11, 2017 10:39 PM

In-place upgrade of Win10 1607 to 1703 and seems to have broke loading ActiveDirectory module.

Get below when attempting to import the module:
Microsoft.ActiveDirectory.Management’ or one of its dependencies. Access is denied.

Works fine and loads other modules listed in my profile:
powershell.exe -ImportSystemModules

Found posts suggesting reinstall old v1607 RSAT snapin, but doesn’t fix

https://www.handheldgroup.com/support-rugged-computers/knowledgebase-KB/22996/

Running:
Name                           Value                                                                                                                                  
----                           -----                                                                                                                                  
PSVersion                      5.1.15063.608                                                                                                                          
PSEdition                      Desktop                                                                                                                                
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                
BuildVersion                   10.0.15063.608                                                                                                                         
CLRVersion                     4.0.30319.42000                                                                                                                        
WSManStackVersion              3.0                                                                                                                                    
PSRemotingProtocolVersion      2.3                                                                                                                                    
SerializationVersion           1.1.0.1 

wthamira's user avatar

wthamira

1,9221 gold badge19 silver badges40 bronze badges

asked Oct 4, 2017 at 16:17

Deinck's user avatar

2

The ActiveDirectory module comes from the Active Directory RSAT tools.

RSAT is always version specific, so any upgrade of Windows (previously this was going to new major versions, now with Windows 10 it includes the new builds), means you will have to reinstall RSAT tools after the upgrade.

Once you do that you should have the ActiveDirectory module once again.

answered Oct 4, 2017 at 17:41

briantist's user avatar

briantistbriantist

44.4k6 gold badges78 silver badges122 bronze badges

6

В одной из предыдущих статей мы показывали, как использовать командлет Set-ADComputer в логон-скрипте для сохранения информации о текущем пользователе в свойствах каждого компьютера в AD. Один из комментаторов вполне резонно отметил, что в таком случае придется устанавливать RSAT с модулем Active Directory for Windows PowerShell на компьютеры всех пользователей, что довольно трудоемко. Я решил попробовать разобраться, можно ли использовать командлеты модуля PS Module for AD без его установки на компьютеры пользователей. И у меня получилось!

Итак, допустим у нас имеется сервер с Windows Server 2012 R2, на котором установлен RSAT и модуль RSAT-AD-PowerShell. Наша задача, скопировать файлы модуля RSAT-AD-PowerShell на рабочую станцию и попробовать импортировать их для запуска различных командлетов модуля AD. В качестве рабочей станции я специально использую Windows 10 LTSC (основана на 1809), чтобы показать, что старые версия модуля RSAT-AD-PowerShell поддерживаются в более новых ОС.

Сначала скопируем все необходимые файлы модуля AD с Windows Server 2012 R2. Создайте папку C:PSADPoSh и скопируйте в нее содержимое каталога C:WindowsSystem32WindowsPowerShellv1.0Modules.

Затем из каталога C:WindowsWinSxS скопируйте файлы:

  • Microsoft.ActiveDirectory.Management.dll
  • Microsoft.ActiveDirectory.Management.resources.dll

Эти библиотеки можно найти поиском по каталогу WinSxS. В моем примере на Windows Server 2012 R2 полный путь выглядел так:

"C:WindowsWinSxSamd64_microsoft.activedirectory.management_31bf3856ad364e35_6.3.9600.16503_none_09aa35cd49da6068Microsoft.ActiveDirectory.Management.dll"

И

"C:WindowsWinSxSamd64_microsoft.activedir..anagement.resources_31bf3856ad364e35_6.3.9600.16384_en-us_efefcf68718a71bcMicrosoft.ActiveDirectory.Management.resources.dll"

библиотеки модуля RSAT-AD-PowerShell Microsoft.ActiveDirectory.Management.dll

Теперь скопируйте каталог C:PSADPoSh (в моем случае его размер составил около 1,3 Мб), на компьютер, на котором отсутствует модуль RSAT AD for Windows PowerShell. В этом примере я использую компьютер с Windows 10.

Попробуем импортировать скопированный модуль Active Directory в текущую PowerShell сессию:

Import-Module "C:PSADPoShMicrosoft.ActiveDirectory.Management.dll"

Import-Module Microsoft.ActiveDirectory.Management.dll

Import-Module "C:PSADPoShMicrosoft.ActiveDirectory.Management.resources.dll"

Модуль успешно импортирован, теперь вы можете использовать любые командлеты модуля AD для управления и получения информации из домена AD (например get-aduser, get-adcomputer, get-adgroup и т.д.).

get-aduser без установки модуля AD Posh

При появлении ошибки ‘Unable to contact the server. This may be because this server does not exist, it is currently down, or it does not have the Active Directory Web Services running‘ нужно проверить, что служба Active Directory Web Services (ADWS) на ближайшем контроллере домена запушена и порт TCP 9389 не блокируется файерволом.

Вы можете найти в домене DC с ролью ADWS с помощью команды:

Get-ADDomainController -Discover -Service «ADWS»

Get-ADDomainController найти Active Directory Web Services

Доступность службы можно проверить с помощью командлета Test-NetConnection:

tnc MSK-DC01 -port 9389

Чтобы выполняить командлеты на конкретном DC, нужно использовать параметр –Server:

Get-aduser aaivanov –server msk-dc01.winitpro.ru

Вы можете использовать командлеты модуля AD пока не закроете сессию PowerShell. Файлы модуля можно скопировать файлы на все компьютеры в домене через GPO,

Сегодня я покажу, как установить и использовать модуль администрирования Active Directory для Windows PowerShell. Командлеты этого модуля можно использовать для получения информации и управлением различными объектами и параметрами AD. Данный модуль в серверных ОС устанавливается в виде отдельного компонента. На десктопные ОС (Windows 10, 8.1, 7) придется установить пакет Remote Server Administration Tools (RSAT) в состав которого входит модуль для взаимодействия с AD из PowerShell. Кроме этого модуля в состав RSAT входят все необходимые графические оснастки управления, утилиты командной строки и модули Windows PowerShell для администрирования Windows и AD. Данный пакет для вашей версии ОС нужно самостоятельно скачать с сайта Microsoft.

    Содержание:

  • Установка модуля Active Directory для Windows PowerShell
  • Импорт и использование модуля PowerShell для Active Directory

Установка модуля Active Directory для Windows PowerShell

Модуль Active Directory для Windows PowerShell впервые появился в Windows Server 2008 R2. Он автоматически устанавливается на контроллерах домена при их установке на них роли ADDS. Для использования комадлетов PowerShell из модуля AD в домене должен быть хотя бы один контроллер с Windows Server 2008 R2 или выше. Если в вашей сети имеются DC только с Windows Server 2003 и 2008, необходимо скачать и установить Active Directory Management Gateway Service. Командлеты PowerShell из модуля Active Directory взаимодействуют с веб-сервисом, который является частью контролера домена с ролью ADDS.

Вы можете установить модуль Active Directory для Windows PowerShell не только на контроллер домена, но и на любой рядовой сервер домена или рабочую станцию. В Windows Server 2016 установить модуль Active Directory для Windows PowerShell можно из графической консоли Server Manager с помощью мастера добавления ролей и компонентов. Достаточно запустить мастер и на этапе выбора компонентов нужно выбрать пункт Средства удаленного администрирования сервера -> Средства администрирования ролей -> Средства AD DS и AD LDS -> Модуль Active Directory для Windows PowerShell (Remote Server Administration Tools > Role Administration Tools > AD DS and AD LDS Tools ->Active Directory module for Windows PowerShell).

установка Модуля Active Directory для Windows PowerShell

Данный модуль можно установит и с помощью PowerShell. Откройте консоль PowerShell с правами администратора и выполните команды:

Import-Module ServerManager

Add-WindowsFeature -Name "RSAT-AD-PowerShell" –IncludeAllSubFeature

установка модуля RSAT-AD-PowerShell из консоли powershell

В Windows 10, Windows 8.1 и Windows 10 для установки модуля RSAT-AD-PowerShell нужно сначала установить соответствующую версию RSAT, после этого модуль нужно включить в Панели управления (Панель управления -> Программы ->Программы и компоненты и нажмите «Включить компоненты Windows» -> Remote Server Administration Tools -> Role Administration Tools -> AD DS and AD LDS Tools -> включите компонент Active Directory Module for Windows POwerShell.

Включить компоненты Windows - Active Directory Module for Windows POwerShell

Либо можно установить модуль с помощью PowerShell:

Enable-WindowsOptionalFeature -Online -FeatureName RSATClient-Roles-AD-Powershell

Импорт и использование модуля PowerShell для Active Directory

В Windows 7 и Windows Server 2008 R2, на которых установлен PowerShell 2.0, чтобы начать пользоваться модулем AD необходимо импортировать его в сессию PowerShell командой:

Import-Module activedirectory

Import-Module activedirectory

Кроме того, вы можете экспортировать модуль с удаленной машины, где он уже установлен и импортировать его в свою сессию PowerShell:

$MySession = New-PSSession -ComputerName MyDomainController
Export-PSsession -Session $MySession -Module ActiveDirectory -OutputModule RemoteADPosh
Remove-PSSession -Session $MySession
Import-Module RemoteADPosh

В Windows Server 2012 R2/ 2016 и Windows 8.1 / Windows 10 модуль (если он установлен) импортируется в сессию автоматически.

Если компьютер включен в домен, по умолчанию создается диск по имени AD:..Вы можете перейти на этот диск командой CD и использовать привычные команды работы с файловой системой для навигации по этому диску. Пути представлены в формате X500.

PS C:> cd AD:
PS AD:> dir

PS AD:> cd "DC=vmblog,DC=ru"

навигация по AD из powershell

Вывести список доступных командлетов модуля для работы с Active Directory можно так:

Get-Command -Module ActiveDirectory

все команды модуля ActiveDirectory

В различных версия Windows доступно разное количество командлетов:

  • Windows Server 2008 R2 — 76 командлетов.
  • Windows Server 2012 — 135 командлетов
  • Windows Server 2012 R2 / 2016 — 147 командлетов.

Итак, теперь вы можете использовать командлеты PowerShell для администрирования AD. На нашем сайты вы можете познакомиться с использованием следующих командлетов из модуля AD для PowerShell: Get-ADGroupMember , Add-ADGroupMember , Move-ADDirectoryServerOperationMasterRole, New-ADGroup.

Officially, the Active Directory module for PowerShell 7 is only supported for Windows 10 and Windows Server 2019. However, as it turns out, you can also install the PowerShell module on Windows Server 2016 and even Windows 7. On Linux and MacOS, you can leverage PowerShell remoting to manage Active Directory. This raises the question of whether Microsoft’s cross-platform approach for PowerShell really makes sense.

Contents

  1. Windows Server 2019
  2. Windows 10
  3. Windows Server 2016
  4. Windows Server 2012 R2 and Windows 8.1
  5. Linux/macOS
  6. Final words
  • Author
  • Recent Posts

Leos has started in the IT industry in 1995. For the past 15+ years he focused on Windows Server, VMware administration and security. Recently, Leos is focusing on automation via Ansible. He is also a Certified Ethical Hacker.

Managing and interacting with Active Directory is one of the most common tasks for any Windows administrator. For many years, the AD module for Windows PowerShell 5.1 (default PowerShell version in Windows 10) was part of the Remote Server Administration Tools (RSAT). This changed with the Windows 10 October 2018 update, where RSAT was included as a set of «features on demand.»

In PowerShell Core 6.0, the first version of cross-platform PowerShell, most of the Windows management modules were available only via the Windows Compatibility module.

This has changed in PowerShell 7, where most of the modules have been updated to work natively, including Active Directory. However, there seems to be one significant drawback. According to the PowerShell 7 module compatibility, these modules are only supported on Windows Server 2019 and Windows 10 systems. So, let’s see what Microsoft has prepared for us.

Windows Server 2019

PowerShell 7 AD module support starts with Windows Server 1809, which is a semiannual release version of Windows Server 2019. The installation has not changed from previous versions and is still performed via Server Manager. Go to Add Roles and Features, and click Next until you get to Features. Then select Active Directory module for Windows PowerShell, as shown in the image.

Install AD module on Windows Server 2019 via Server Manager

Install AD module on Windows Server 2019 via Server Manager

Since we’re discussing PowerShell here, let’s stick to it and install the feature with PowerShell a command:

Install-WindowsFeature RSAT-AD-PowerShell

Note that I’m doing this in PowerShell 7. If you don’t have PowerShell 7 yet, follow this post to get it.

Install AD module with PowerShell

Install AD module with PowerShell

Windows 10

Support for Windows 10 starts with the same version build as with the server edition: 1809. As I already mentioned, the RSAT tools were shifted from being a standalone package to being a feature on demand in Windows 10. Select App and Features > Optional Features > Add a feature. Type RSAT in the search field and select the second option—RSAT: Active Directory Domain Services and Lightweight Directory Services Tools.

Install the AD module on Windows 10

Install the AD module on Windows 10

If you want to add the feature with PowerShell, the command is a bit different from the server version.

Get-WindowsCapability -Online -Name Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0 | Add-WindowsCapability –Online

Note: You can omit the version number from the Name parameter.

Install the AD module with PowerShell on Windows 10

Install the AD module with PowerShell on Windows 10

As you can see, everything works well in both the desktop and the server editions. The module is automatically imported when you run the first command.

Windows Server 2016

According to the documentation, the module is only supported in the Windows versions listed above. Let’s see what happens if we try to install and use the module in older versions.

First, I tested it with Windows Server 2016. After installing PowerShell 7, I added the Active Directory module using the Install-WindowsFeature RSAT-AD-PowerShell command and tried to run a query on the computer objects.

Testing the PowerShell 7 AD module on Windows Server 2016

Testing the PowerShell 7 AD module on Windows Server 2016

What a surprise! The module works well, even on Windows Server 2016. Is there another inconsistency in Microsoft’s own documentation, or is there a specific reason to leave version 2016 out of support?

Windows Server 2012 R2 and Windows 8.1

My last test was done on Windows 8.1, which is the same core as Windows Server 2012 R2. PowerShell 7 is supported on both systems, but the AD module is not. After spinning up the VM and installing PowerShell 7 and the standalone RSAT package for Windows 8.1, I got the following error messages when trying to query AD:

Get-ADComputer: The ‘Get-ADComputer’ command was found in the module ‘ActiveDirectory’, but the module could not be loaded. For more information, run ‘Import-Module ActiveDirectory’.

Get-ADUser: The ‘Get-ADUser’ command was found in the module ‘ActiveDirectory’, but the module could not be loaded. For more information, run ‘Import-Module ActiveDirectory’.

When you do as the error message suggests and run the Import-Module ActiveDirectory command, you get another error message.

Import-Module: Detected Windows PowerShell version 4.0. Windows PowerShell 5.1 is required to load modules using Windows PowerShell compatibility feature. Install Windows Management Framework (WMF) 5.1 from https://aka.ms/WMF5Download to enable this feature.

Testing on Windows 8.1

Testing on Windows 8.1

OK, so let’s go further and install the WMF 5.1 Framework. After the installation and reboot, I made another attempt.

AD module on unsupported Windows 8.1

AD module on unsupported Windows 8.1

Unsurprisingly, it works fine. Wondering why? The answer is simple. PowerShell 7 still uses the same old AD module from Windows PowerShell 5.1 (WMF 5.1). The only difference now is that it is natively supported and can be used without the Windows Compatibility module, as was the case in PowerShell Core 6.

Linux/macOS

So far, it is obvious that the AD module cannot be run on either Linux or macOS. The reason is pretty simple. The module is part of the RSAT tools, which are not available for either platform at all. So if you wish to manage AD from a Linux or macOS machine, you still need to have a Windows machine around to connect to.

In general, the basic remoting principles can be used here:

  • Enter-PSSession
  • Invoke-Command

The screen below shows SSH remoting to a Windows machine from CentOS. As you can see, I could use the AD module this way (assuming it is installed on the remote machine).

Using the AD module via Linux SSH remoting

Using the AD module via Linux SSH remoting

Note: Remoting to a Windows machine from Linux or macOS is only possible via SSH. Instructions on how to set up SSH remoting can be found here.

Final words

In this post, we took a deep dive into where the Active Directory module for PowerShell 7 actually works, although it is stated as unsupported on some of the systems. The inconsistencies in Microsoft’s own documentation about PowerShell 7 continue to grow.

Also, the approach from Microsoft with cross-platform compatibility is quite unsatisfying. What kind of cross-platform compatibility is it when you are unable to manage many of the standard Windows features from Linux or macOS? For most of the common administration tasks, you still need a Windows machine around.

Many scripts written for Windows will not work on Linux simply because the needed modules are not available. Considering that the vast majority of admins using PowerShell work on Windows, Microsoft should focus on backward combability instead of cross-platform support because both approaches are inherently incompatible.

What’s your take? What is more important for PowerShell? Backward compatibility or cross-platform support?

avatar

Вопрос:

У меня возникла проблема с созданием ActiveDirectory модуля импорта на Server 2008 SP2 (64 бит).

  • Установлена ​​.NET Framework 3.5 SP1
  • Загружаю Windows6.0-KB968934-x86.msu(для ADWS)
  • В этом файле не установлено: “Обновление не относится к моей системе”
  • Выполнение некоторых исследований (http://anti-american.rssing.com/chan-2091246/all_p15.html) Я установил исправление в статью KB96966 и указанное выше обновление.
  • После перезагрузки я заметил, что в службах веб-службы Active Directory работают
  • Я открыл административную подсказку PS и выполнил Импорт-Модуль ActiveDirectory, но…

… Я получаю:

Import-Module : The specified module 'activedirectory' was not loaded because no valid     module file was found in any module directory.
At line:1 char:14
+ import-module <<<<  activedirectory
+ CategoryInfo          : ResourceUnavailable: (activedirectory:String) [Import-    Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

Если какая-либо помощь, вот некоторая информация в PSModule Path, модули и версия:

PS C:Windowssystem32> $env:PSModulePath
C:UsersischmdDocumentsWindowsPowerShellModules;C:Windowssystem32WindowsPowerShellv1.0Modules

PS C:Windowssystem32> Get-Module -ListAvailable

ModuleType Name                      ExportedCommands
---------- ----                      ----------------
Manifest   BitsTransfer              {}
Manifest   PSDiagnostics             {}

PS C:Windowssystem32> $PSVersionTable.psversion

Major  Minor  Build  Revision
-----  -----  -----  --------
2      0      -1     -1


PS C:Windowssystem32> $host.version

Major  Minor  Build  Revision
-----  -----  -----  --------
2      0      -1     -1

Любая помощь приветствуется. Основная цель этого – команда GET-AdUser для автоматизации какого-либо процесса, но на данный момент они были в тупике. Мой единственный вывод заключается в том, что это невозможно с Windows 2000 SP2…

Ответ №1

Модуль AD Powershell должен быть указан в установленных функциях. См. Изображение:

AD Powershell module should be listed under installed Features..

Ответ №2

Ответ №3

Вы можете установить оснастку Active Directory с помощью Powershell в Windows Server 2012, используя следующую команду:

Install-windowsfeature -name AD-Domain-Services -IncludeManagementTools

Это помогло мне, когда у меня возникли проблемы с экраном функций из-за ошибок AppFabric и Windows Update.

Ответ №4

Модуль ActiveDirectory для powershell может быть установлен путем добавления функции RSAT-AD-Powershell.

В окне с повышенными полномочиями:

Add-WindowsFeature RSAT-AD-PowerShell

или

Enable-WindowsOptionalFeature -FeatureName ActiveDirectory-Powershell -Online -All

Ответ №5

Еще лучше использовать неявное удаленное использование модуля с другого компьютера!

$s = New-PSSession Server-Name
Invoke-Command -Session $s -ScriptBlock {Import-Module ActiveDirectory}
Import-PSSession -Session $s -Module ActiveDirectory -Prefix REM

Это позволит вам использовать модуль с удаленного ПК до тех пор, пока подключен PSSession.

Дополнительная информация:
https://technet.microsoft.com/en-us/library/ff720181.aspx

Ответ №6

Это может быть старый пост, но если кто-то все еще сталкивается с этой проблемой после попытки всех вышеупомянутых шагов, убедитесь, что путь по умолчанию для модуля PowerShell указан в переменной среды “PSModulePath”.

Путь по умолчанию должен быть “% SystemRoot%system32WindowsPowerShellv1.0Modules ”

Like this post? Please share to your friends:
  • Imovie скачать бесплатно для windows 10 на русском языке
  • Imo скачать на ноутбук на русском бесплатно windows 10
  • Imo скачать на компьютер на русском бесплатно windows 10
  • Imo скачать на компьютер windows 7 32 bit
  • Imo скачать для компьютера windows 10