The term 'Get-ADUser' is not recognized as the name of a cmdlet

前端 未结 6 1875
走了就别回头了
走了就别回头了 2020-12-07 12:58

I have used the following query to list the users in a windows 2008 server, but failed and got the below error.

$server=\'client-pc-1\';$pwd= convertto-secur         


        
相关标签:
6条回答
  • 2020-12-07 13:17

    If you don't see the Active Directory, it's because you did not install AD LS Users and Computer Feature. Go to Manage - Add Roles & Features. Within Add Roles and Features Wizard, on Features tab, select Remote Server Administration Tools, select - Role Admininistration Tools - Select AD DS and DF LDS Tools.

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

    0 讨论(0)
  • 2020-12-07 13:23

    If the ActiveDirectory module is present add

    import-module activedirectory
    

    before your code.

    To check if exist try:

    get-module -listavailable
    

    ActiveDirectory module is default present in windows server 2008 R2, install it in this way:

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

    For have it to work you need at least one DC in the domain as windows 2008 R2 and have Active Directory Web Services (ADWS) installed on it.

    For Windows Server 2008 read here how to install it

    0 讨论(0)
  • 2020-12-07 13:27

    For the particular case of Windows 10 October 2018 Update or later activedirectory module is not available unless the optional feature RSAT: Active Directory Domain Services and Lightweight Directory Services Tools is installed (instructions here + uncollapse install instructions).

    Reopen Windows Powershell and import-module activedirectory will work as expected.

    0 讨论(0)
  • 2020-12-07 13:30

    Check here for how to add the activedirectory module if not there by default. This can be done on any machine and then it will allow you to access your active directory "domain control" server.

    EDIT

    To prevent problems with stale links (I have found MSDN blogs to disappear for no reason in the past), in essence for Windows 7 you need to download and install Remote Server Administration Tools (KB958830). After installing do the following steps:

    • Open Control Panel -> Programs and Features -> Turn On/Off Windows Features
    • 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 allow Windows to install the feature

    Windows server editions should already be OK but if not you need to download and install the Active Directory Management Gateway Service. If any of these links should stop working, you should still be able search for the KB article or download names and find them.

    0 讨论(0)
  • 2020-12-07 13:34
    get-windowsfeature | where name -like RSAT-AD-PowerShell | Install-WindowsFeature
    
    0 讨论(0)
  • 2020-12-07 13:41

    Open Turn On/Off Windows Features.

    Make sure you have Active Directory Domain Services selected. If not, install it.

    0 讨论(0)
提交回复
热议问题