The term "Get-ADUser" is not recognized as a cmdlet name

I used the following query to list users on a Windows 2008 server, but failed and received the following error.

$server='client-pc-1';$pwd= convertto-securestring 'password$' -asplaintext - force;$cred=new-object -typename System.Management.Automation.PSCredential -argumentlist 'Administrator',$pwd; invoke-command -computername $server -credential $cred -scriptblock {Get-ADUser -Filter (enabled -ne $true)} 

An exception is given below ... Can someone help me solve this problem?

 The term 'Get-ADUser' 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. + CategoryInfo : ObjectNotFound: (Get-ADUser:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException 
+48
powershell
Jul 09 '13 at 12:46 on
source share
4 answers

If an ActiveDirectory module is present, add

 import-module activedirectory 

in front of your code.

To check if an attempt exists:

 get-module -listavailable 

ActiveDirectory is present by default in Windows Server 2008 R2, install it as follows:

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

For it to work, you need at least one DC in the domain, like Windows 2008 R2, and it has Active Directory Web Services (ADWS) installed.

In Windows Server 2008, read here how to install it.

+69
Jul 9 '13 at 12:50
source share

Check here for how to add an activedirectory module if not by default. This can be done on any computer, and then it will allow you to access your active domain management directory.

EDIT

To prevent problems with outdated links (I found that MSDN blogs disappear for no reason in the past), in essence for Windows 7 you need to download and install Remote Server Administration Tools (KB958830) . After installation, follow these steps:

  • Open Control Panel β†’ Programs and Features β†’ Turn Windows Features On / Off
  • Find "Remote Server Administration Tools" and expand it
  • Find Role Administration Tools and expand it
  • Find "AD DS and AD LDS Tools" and expand it
  • Check the box next to "Active Directory Module for Windows PowerShell."
  • Click OK and let Windows install this feature.

Server versions of Windows should be fine, but if you don’t need to download and install the Active Directory Management Gateway service . If any of these links stop working, you can still find the article in KB or download the names and find them.

+25
Apr 2 '14 at 16:25
source share

If you do not see Active Directory, this is because you did not install AD LS users and the computer function. Go to the Management section - add roles and functions. In the "Add Roles and Features Wizard" section of the "Features" tab, select "Remote Server Administration Tools", select "Role Administration Tools" - select "AD DS and DF LDS Tools".

After that, you can see the PS Active Directory package.

+3
Aug 19 '14 at 17:01
source share
 get-windowsfeature | where name -like RSAT-AD-PowerShell | Install-WindowsFeature 
-2
Jul 10 '17 at 12:25
source share



All Articles