locked
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. RRS feed

  • Question

  • I want to use powershell Core 6.0 (on Centos7.2) to mange Exchange 2013 by psremoting over winrm ,but failed.

    In my test env :

    it works normal when i connect to DC server : add/delete/modify AD User

    Also i can use new-pssession to connect  to my exchange 2013 env ,but when i run powershell cmdlet  this error comes out :

    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.

    I don't konw what happens

    Any reply would be appreciated

    BTW does there have a method to manage exchagne from linux?
    • Edited by ynhou Wednesday, March 20, 2019 2:32 PM
    Wednesday, March 20, 2019 2:04 PM

Answers

  • PS core 6 cannot run most Windows only commands at this time.

    PSSession uses the PowerShell version installed on the remote server.


    \_(ツ)_/

    • Marked as answer by ynhou Tuesday, March 26, 2019 2:57 AM
    Wednesday, March 20, 2019 3:18 PM

All replies

  • PS core 6 cannot run most Windows only commands at this time.

    PSSession uses the PowerShell version installed on the remote server.


    \_(ツ)_/

    • Marked as answer by ynhou Tuesday, March 26, 2019 2:57 AM
    Wednesday, March 20, 2019 3:18 PM
  • 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.

    I am no sure of the various bits and pieces of your scenario - but the above error is commonly due to firewall access restrictions to the domain controllers on TCP 9389.  It's typically not included in a "standard" list of allowed AD ports.

    Wednesday, March 20, 2019 3:46 PM
  • hi jrv:

    In my case, i can create 2 sessions:

    session1 is bind to dc server 

    session2 is bind to exchange server 

    when i use session1 , i can add/del/modify ADUsers ,such as : get-aduser -identity test

    but when i use session2 , the same command line (get-aduser -identity test),this error comes out

    maybe i should choose this way (only on windows) in order to manage  my exchange 2013

    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://<ServerFQDN>/PowerShell/ -Authentication Kerberos -Credential $UserCredential

    Thursday, March 21, 2019 1:59 AM
  • thanks ticker,

    maybe exchange does not support such way

    all i can find on technet documents is :

    https://docs.microsoft.com/en-us/powershell/exchange/exchange-server/connect-to-exchange-servers-using-remote-powershell?view=exchange-ps

    first install Exchange management tools 

    then connect to Exchange Server using remote powershell

    Thursday, March 21, 2019 2:05 AM
  • You cannot use CmdLets for AD from a third system in a remote session.  If the DC and CmdLets are on the same server it will work.  Almost any other scenario won't either due to security restrictions or other issues caused by remoting from outside of s domain.


    \_(ツ)_/

    Thursday, March 21, 2019 2:44 AM
  • hi, Jrv:

    actually it works

    here is  my test:

    $server_Ip = "DC Server IP"
    $user = "username"
    $user_name = "yourdomainname\$user"
    $pass = "user password"
    $pw = ConvertTo-SecureString $pass -AsPlainText -Force
    $cred = New-Object System.Management.Automation.PSCredential ($user_name,$pw)
    $session2 = New-PSSession -ComputerName $server_Ip -Credential $cred -Authentication Negotiate

    1、enter-pssession -id $mysessionid;Remove-ADuser -identity test

    OR

    2、Invoke-Command -session $session2 -ScriptBlock { Remove-ADuser -identity test }

    this cmdlet works fine on my Centos7.2

    Again ,thanks for your replies 

    Thursday, March 21, 2019 5:38 AM