I have a HA-Proxy, which handles the SSL encryption but cannot handle the SMTPS or IMAPS encryption.
So I have installed openssh on the Exchange server and I have written a powershell script to do the import and enable stuff.
My Problem is now, when I launch the Script via ssh from the linux machine, It gives me this Error:
root@Test-Proxy-01:~/bin# ssh administrator@exchange@192.168.70.100 powershell C:\\Scripts\\Working\\Renew_Cert\\Renew_Cert.ps1 -Path C:\\Scripts\\Working\\Renew_Cert\\Cert\\testexchange.hosttech.eu.pfx VERBOSE: Connecting to EX-01.exchange.test. New-PSSession : [ex-01.exchange.test] Connecting to remote server ex-01.exchange.test failed with the following error message : WinRM cannot process the request. The following error with errorcode 0x8009030e occurred while using Kerberos authentication: A specified logon session does not exist. It may already have been terminated. Possible causes are: -The user name or password specified are invalid. -Kerberos is used when no authentication method and no user name are specified. -Kerberos accepts domain user names, but not local user names. -The Service Principal Name (SPN) for the remote computer name and port does not exist. -The client and remote computers are in different domains and there is no trust between the two domains. After checking for the above issues, try the following: -Check the Event Viewer for events related to authentication. -Change the authentication method; add the destination computer to the WinRM TrustedHosts configuration setting or use HTTPS transport. Note that computers in the TrustedHosts list might not be authenticated. -For more information about WinRM configuration, run the following command: winrm help config. For more information, see the about_Remote_Troubleshooting Help topic. Other Possible Cause: -The domain or computer name was not included with the specified credential, for example: DOMAIN\UserName or COMPUTER\UserName. At line:1 char:1+ New-PSSession -ConnectionURI "$connectionUri" -ConfigurationName Micr ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin gTransportException+ FullyQualifiedErrorId : 1312,PSSessionOpenFailed Exception calling "GetComputerSite" with "0" argument(s): "An operations error occurred." At C:\Program Files\Microsoft\Exchange Server\V15\bin\ConnectFunctions.ps1:164 char:2+ $localSite=[System.DirectoryServices.ActiveDirectory.ActiveDirect ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException+ FullyQualifiedErrorId : ActiveDirectoryOperationException Failed to connect to an Exchange server in the current site.
I am logged in as domain administrator and to initialize the Exchange Shell, I have this on top of my script:
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 . "$PSScriptRoot\Remote_Connect\RemoteExchange.ps1" Connect-ExchangeServer -auto
The RemoteExchange.ps1 was slightly modifyed to remove the banner. This Worked so far, when run locally.
How can I successfully start the script?