Powershell: Cannot Connect to Office 365 Exchange 2016 via terminal in 10.15.1 (Catalina)

Created on 25 Nov 2019  Â·  37Comments  Â·  Source: PowerShell/PowerShell

Hello,

I am experiencing the below error.

New-PSSession : This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system

This is not representative of the issue resolved and closed in issue #5561

I have the below version of Powershell installed currently

Name Value
---- -----
PSVersion 6.0.4
PSEdition Core
GitCommitId v6.0.4
OS Darwin 19.0.0 Darwin Kernel Version 19.0.0: T...
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Thanks in advance.

Issue-Question Resolution-Answered

Most helpful comment

The issue here is that Homebrew has removed openssl 1.0 here https://github.com/Homebrew/homebrew-core/pull/46876/commits/5c3de7dd7c1eec7ed10b6456510163895c397201

With powershell looking explicitly for the 1.0 version here

otool -L /usr/local/microsoft/powershell/6/libmi.dylib
/usr/local/microsoft/powershell/6/libmi.dylib:
    @rpath/libmi.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)
    /usr/lib/libpam.2.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/local/opt/openssl/lib/libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)

The workaround for me at the moment is to revert homebrew openssl to 1.0
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/64555220bfbf4a25598523c2e4d3a232560eaad7/Formula/openssl.rb

and copy the dylib files from /usr/local/opt/openssl/lib to a temporary location before re-installing homebrew openssl and moving the files back to /usr/local/opt/openssl/lib

All 37 comments

The most current stable version of PowerShell is 6.2.3. I'd recommend updating at least to that version, and if this issue isn't fixed there, do please try the latest v7-preview, as this issue may have already been resolved. 🙂

Sadly, I anticipated this and updated in advance but sadly have the same result.

Name Value
---- -----
PSVersion 6.2.3
PSEdition Core
GitCommitId 6.2.3
OS Darwin 19.0.0 Darwin Kernel Version 19.0.0: Thu…
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

can also confirm I am receiving this error on macOS High Sierra and Catalina as well. Have tried with both homebrew and macport openssl installs.

Just to continue on the thread for this issue. I have since reinstalled my OS to a fresh Catalina build with the same issue present.

I am only able to SSH to a server in order to have it running and stable.

I’d really appreciate a fix on this as soon as.

I saw that it was working on 6.0.2 of powershell, perhaps something changed that caused it to break on macOS?

Sadly, I anticipated this and updated in advance but sadly have the same result.

Name Value

PSVersion 6.2.3
PSEdition Core
GitCommitId 6.2.3
OS Darwin 19.0.0 Darwin Kernel Version 19.0.0: Thu…
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

I have the same error, same version of powershell on Mac 10.15.1 when trying to connect to Office 365

Also having this issue with the following installed:

Mac OS 10.15.1

PSVersion 6.2.3
PSEdition Core
GitCommitId 6.2.3
OS Darwin 19.0.0 Darwin Kernel Version 19.0.0: Thu…
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

error:

New-PSSession : This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system.

 $session=New-PSSession -Configuration Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $cred -Authentication Basic -AllowRedirection
New-PSSession: This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system.
$psversiontable 

Name                           Value
----                           -----
PSVersion                      7.0.0-preview.6
PSEdition                      Core
GitCommitId                    7.0.0-preview.6
OS                             Darwin 19.0.0 Darwin Kernel Version 19.0.0: Thu…
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Same here:

New-PSSession
New-PSSession : This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system.
At line:1 char:1

I can confirm that I have the same issue. Tried pwsh and pwsh-preview

Name                           Value
----                           -----
PSVersion                      7.0.0-rc.1
PSEdition                      Core
GitCommitId                    7.0.0-rc.1
OS                             Darwin 19.2.0 Darwin Kernel Version 19.2.0: Sat Nov  9 03:47:04 PST 2019; root:xnu-6153.61.1~20/RELEASE_X86_64
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Name Value ---- ----- PSVersion 6.2.3 PSEdition Core GitCommitId 6.2.3 OS Darwin 19.2.0 Darwin Kernel Version 19.2.0: Sat Nov 9 03:47:04 PST 2019; root:xnu-6153.61.1~20/RELEASE_X86_64 Platform Unix PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0

Edit: Possibly related to #10600, but not a direct dupe, since that's with the SDK, not the CLI

I was able to get the CLI working on macOS 10.15 by symlinking to system provided libssl and libcrypto in /usr/lib/libssl.dylib and /usr/lib/libcrypto.dylib.

I suspect there are really two issues here:

  1. pwsh (specifically libmi.dylib) expects OpenSSL to be provided by Homebrew in the Homebrew location /usr/local/opt/openssl/lib/
  2. pwsh is expecting an older version of OpenSSL that has the " _SSL_library_init" symbol in it, so linking to a newer version from Homebrew, MacPorts, or hand-compiled doesn't work as it should, yielding the following error:

dyld: lazy symbol binding failed: Symbol not found: _SSL_library_init
Referenced from: /usr/local/microsoft/powershell/6/libmi.dylib
Expected in: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib

Name Value
---- -----
PSVersion 6.2.3
PSEdition Core
GitCommitId 6.2.3
OS Darwin 19.3.0 Darwin Kernel Version 19.3.0: Sun Dec 8 22:27:29 PST 2019; root:xnu-6153.80.8.0.1~15/RELEASE_X86_64
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Same problem too... unable to use PWSH for Office 365.

Name                           Value
----                           -----
PSVersion                      7.0.0-rc.1
PSEdition                      Core
GitCommitId                    7.0.0-rc.1
OS                             Darwin 19.2.0 Darwin Kernel Version 19.2.0: Sat Nov  9 03:47:04 PST 2019; root:xnu-6153.61.1~20/RELEASE_X86_64
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Same here. Tried every combo.
New-PSSession: This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system.

The issue here is that Homebrew has removed openssl 1.0 here https://github.com/Homebrew/homebrew-core/pull/46876/commits/5c3de7dd7c1eec7ed10b6456510163895c397201

With powershell looking explicitly for the 1.0 version here

otool -L /usr/local/microsoft/powershell/6/libmi.dylib
/usr/local/microsoft/powershell/6/libmi.dylib:
    @rpath/libmi.dylib (compatibility version 0.0.0, current version 0.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)
    /usr/lib/libpam.2.dylib (compatibility version 3.0.0, current version 3.0.0)
    /usr/local/opt/openssl/lib/libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)

The workaround for me at the moment is to revert homebrew openssl to 1.0
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/64555220bfbf4a25598523c2e4d3a232560eaad7/Formula/openssl.rb

and copy the dylib files from /usr/local/opt/openssl/lib to a temporary location before re-installing homebrew openssl and moving the files back to /usr/local/opt/openssl/lib

@slabber Thank you for posting this work-around. It worked great for me and got me back up and running.

How can I revert to homebrew openssl 1.0 ?
I have installed openssl 1.1 and it is refusing to uninstall openssl

@hampsink See the comment above.

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/64555220bfbf4a25598523c2e4d3a232560eaad7/Formula/openssl.rb

should replace OpenSSL 1.1 with 1.0 on homebrew

Hey @slabber , thanks for the suggested workaround.

What do you mean by "re-installing homebrew openssl"? Is that the newest 1.1 version? Is it really necessary to copy the 1.0 dylib files and copy them back, instead of just trying with the reverted openssl version?

Reason I'm asking this is that PWSH is now trowing a new error:
New-PSSession : [outlook.office365.com] Connecting to remote server outlook.office365.com failed with the following error message : Basic Authorization failed for user [email protected] For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:12
+ $Session = New-PSSession -ConfigurationName Microsoft.Exchange -Conne ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.Management.A\u2026tion.RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : 2,PSSessionOpenFailed

Could this be the result of too much faulty attempts? I'm 100% sure my credentials are correct though.

@Jeralckx I've not investigated this but my concern is that the workaround could break any other packages that have openssl 1.1 as a dependency. That's why I suggest re-installing it back again once you have the necessary files you need to satisfy the powershell dependency on 1.0

Just FYI, I'm connecting using an application credential created here:
https://account.activedirectory.windowsazure.com/AppPasswords.aspx

And then with the following commands

$secpasswd = ConvertTo-SecureString "<pass from above>" -AsPlainText -Force
$UserCredential = New-Object System.Management.Automation.PSCredential ("[email protected]", $secpasswd)
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session

Too bad, it's still throwing the same error notice regarding WSMan, even after having a go with your workaround @slabber ...

New-PSSession : This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system.
At line:1 char:12
+ $Session = New-PSSession -ConfigurationName Microsoft.Exchange -Conne ...
+            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ResourceUnavailable: (:) [New-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : System.Management.Automation.Remoting.PSRemotingDataStructureException,Microsoft.PowerShell.Commands.NewPSSessionCommand

@richbarfoot Seems like you got it working? Any ideas?
Thanks!

@hampsink See the comment above.

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/64555220bfbf4a25598523c2e4d3a232560eaad7/Formula/openssl.rb

should replace OpenSSL 1.1 with 1.0 on homebrew

@slabber
When I run the command, it stops with :

Error: openssl 1.1.1d is already installed
To upgrade to 1.0.2t, run brew upgrade openssl

And when I do that it still says 'Warning: openssl 1.1.1d already installed'

@slabber
It worked for me with brew upgrade https://raw.githubusercontent.com/Homebrew/homebrew-core/64555220bfbf4a25598523c2e4d3a232560eaad7/Formula/openssl.rb

But then I get the same kind of error like @Jeralckx
And maybe that is because I forgot to backup and copy back the dylib files.... ?

Is there another way to get the dylib files ?

Now I am also back at the WSMan error again...

Is there a solution yet?
I run into the same error on MacOS 10.15.3

@maeck Did you try the workaround above of reverting openssl homebrew to 1.0, saving the dylib files somewhere, reinstalling openssl 1.1 and copying the dylib files back again? The following files MUST exist. It's best to follow the working whilst not being in the /usr/local/opt/openssl folder as I think homebrew completely removes the folder during upgrade/install/reinstall.

/usr/local/opt/openssl/lib/libssl.1.0.0.dylib
/usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib

Still broken in powershell 7.0

@slabber Yes, your workaround works. Also with Pwsh v7. Thank you very much.
Now I need only to wait for the cmdlets for O365 to create users, mailboxes, etc.

Here's a hack that's working for me for now, until pwsh is updated to be compatible with openssl1.1+ or removes the dependency on WSMan:

brew install https://github.com/luckman212/openssl10/releases/download/1.0.2u/[email protected]
rm /usr/local/opt/openssl
ln -s /usr/local/Cellar/[email protected]/1.0.2u /usr/local/opt/openssl

@PaulHigin What is right resolution here? WinRM deprecated?

Guys, any news yet? Still no working solution for me...

@slabber I get the error notice saying I can't sign in to office365. Even after correctly reinstalling openssl and copying the dylib files.

Then I tried @luckman212 's workaround, but still no luck... Same error.

Any suggestions on how to proceed?

Thanks again!

@Jeralckx It seems there is a beta module for Cloud Exchange which should be compatible with PowerShell Core.

@iSazonov Do you have any links for that module?

@luckman212 No. It seems it was a tweet a week ago. And it is seem not open beta. You could ask Exchange team.

This issue has been marked as answered and has not had any activity for 1 day. It has been closed for housekeeping purposes.

Why did this issue get closed? Is there a way to connect to Exchange Online now on pwsh core on macOS?

It is an external issue - now Enchange team works on beta Exchange Online module compatible with PowerShell Core.

Was this page helpful?
0 / 5 - 0 ratings