Importing ActiveDirectory module 'unable to contact the server' issue.

Tagged: 

This topic contains 6 replies, has 4 voices, and was last updated by  Ron 1 week ago.

  • Author
    Posts
  • #79645

    TomW
    Participant

    Guys I am really struggling here. Hoping you can help shed some light on my issue where google searching has not.

    I am unable to import-module activedirectory without error:
    PS> Import-Module ActiveDirectory
    WARNING: Error initializing default drive: '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.'.

    Then when I look at imported modules, I see its there:
    PS> Get-Module

    ModuleType Version Name ExportedCommands
    ———- ——- —- —————-
    Manifest 1.0.0.0 ActiveDirectory {Add-ADComputerServiceAccount, Add-ADDomainControllerPassw...
    Manifest 3.1.0.0 Microsoft.PowerShell.Management {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Con...

    Then when I try ad cmdlets and syntax I get errors. Like the following:

    PS> get-aduser -filter {Name -like *jones*}
    Get-ADUser : 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.
    At line:1 char:1
    + Get-ADUser "*jones*"
    + ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ResourceUnavailable: (*jones*:ADUser) [Get-ADUser], ADServerDownException
    + FullyQualifiedErrorId : Unable to contact the server. This may be because this server does not exist, it is curr
    ently down, or it does not have the Active Directory Web Services running.,Microsoft.ActiveDirectory.Management.Co
    mmands.GetADUser

    Any ideas here?

    1. Windows 7 SP1
    2. Windows .NET Framwork 4.0 installed
    3. RSAT x64 for win7 installed
    4. I am running these commands from the win7 workstation. I do not have access to the DC's.
    5. I can access active directory users and computers just fine. It looks like the DC's are running SRV 2008 R2.

    Thanks,
    Tom

  • #79666

    Max Kozlov
    Participant

    you can use

    Get-ADUser -Server 'servername'
    

    to contact any AD server

    but seens there may be firewall or somethong

  • #79765

    TomW
    Participant

    Thanks. I did try that as well, I ran a "get-addomaincontroller -discovery -service "adws" and found a proper server. I used that hostname with the -server parameter and still get the same error.

    Is it firewall issue? Or could it be permissions issue?

    I can use management tool AD Users and Groups FYI.

    Thanks,
    Tom

  • #79873

    Ron
    Participant

    It wants to map a PS drive to your default domain. You can override this and just load the commandlets by setting en env variable.

    $Env:ADPS_LoadDefaultDrive = 0
  • #79877

    Rick
    Participant

    This might be a silly question but do you have at least 1 2008 R2 or higher domain controller or a server running ADWS? This is required to use AD cmdlets.

  • #79886

    TomW
    Participant

    Ron, that worked as far as stopping the error when performing a import-module activedirectory cmdlet but it still fails when trying to use the cmdlets for AD like get-aduser. Same error as above.

    Rick, yes I can actually run an ad cmdlet like below and get a proper DC:

    Get-ADDomainController -Discover -Service "ADWS"

    It returns a DC which I then append to the -server parameter and still doesn't work.

    Any other suggestions? I tried PS version 2, version 4, and version 5 just in case... Same issue.

    Tom

    • #79994

      Ron
      Participant

      Hard to guess what the issue might be. I can only suggest to make you are using the full hostname for the domain controller.

You must be logged in to reply to this topic.