Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Wednesday, March 20, 2019 2:04 PM
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?
All replies (6)
Wednesday, March 20, 2019 3:18 PM ✅Answered
PS core 6 cannot run most Windows only commands at this time.
PSSession uses the PowerShell version installed on the remote server.
\(ツ)_/
Wednesday, March 20, 2019 3:46 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.
Thursday, March 21, 2019 1:59 AM
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 2:05 AM
thanks ticker,
maybe exchange does not support such way
all i can find on technet documents is :
first install Exchange management tools
then connect to Exchange Server using remote powershell
Thursday, March 21, 2019 2:44 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 5:38 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