0

I'm trying to resolve an issue we are facing.

we are able to communicate to Exchange Server EMS Script from remote machine through winRM HTTP authentication.

$newSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://test.domain.com/PowerShell/ -Authentication Kerberos -Credential $Credentials    
Import-PSSession $newSession

But we have to impose WinRM HTTPS, so I have set everything required for that including certificate creation , winRM settings etc.

And we are able to connect to remote machine where exchange server is available:

Enter-PSSession -ComputerName test.domain.com -Credential $credentials -UseSSL

and this works.

Now when I'm using -UseSSL in New-PSSession/Enter-PSSession for EMS, its not working:

$newSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://test.domain.com/PowerShell/ -Credential $Credentials -UseSSL

Error: New-PSSession : Parameter set cannot be resolved using the specified named parameters.

Please note: I need WinRM (powershell) Connectivity through HTTPS: -UseSSL Authentication. Not with Kerberos/Defaut/CredSSP

1 Answers1

0

You need to look at parameter sets in the documentation https://technet.microsoft.com/en-us/library/hh849717.aspx eg when you using URI eg

Parameter Set: Uri New-PSSession [-ConnectionUri] [-AllowRedirection] [-Authentication {Default | Basic | Negotiate | NegotiateWithImplicitCredential | Credssp | Digest | Kerberos} ] [-CertificateThumbprint ] [-ConfigurationName ] [-Credential ] [-EnableNetworkAccess] [-Name ] [-SessionOption ] [-ThrottleLimit ] [ ]

What you should be doing is specify the https prefix instead of using the -useSSL switch which will ensure that connection is over https ("https://test.domain.com/PowerShell/);. The -useSSL is meant to be used when you using the -ComputerName parameter.

Glen Scales
  • 20,495
  • 1
  • 20
  • 23