question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PSRemoting Support for Apple M1 Silicon

See original GitHub issue

Steps to reproduce

Enter-PSSession -ComputerName Server01 -Port 90 -Credential Domain01\User01


Expected behavior

  • Interactive removing session is created

Actual behavior

  • Error is returned:

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

ErrorCode                   : 0
TransportMessage            : 
ErrorRecord                 : This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system.
WasThrownFromThrowStatement : False
TargetSite                  : Void .ctor()
StackTrace                  :    at System.Management.Automation.Remoting.Client.WSManClientSessionTransportManager.WSManAPIDataCommon..ctor()
                                 at System.Management.Automation.Remoting.Client.WSManClientSessionTransportManager..ctor(Guid runspacePoolInstanceId, WSManConnectionInfo 
                              connectionInfo, PSRemotingCryptoHelper cryptoHelper, String sessionName)
                                 at System.Management.Automation.Runspaces.WSManConnectionInfo.CreateClientSessionTransportManager(Guid instanceId, String sessionName, 
                              PSRemotingCryptoHelper cryptoHelper)
                                 at System.Management.Automation.Remoting.ClientRemoteSessionDSHandlerImpl..ctor(ClientRemoteSession session, PSRemotingCryptoHelper 
                              cryptoHelper, RunspaceConnectionInfo connectionInfo, URIDirectionReported uriRedirectionHandler)
                                 at System.Management.Automation.Remoting.ClientRemoteSessionImpl..ctor(RemoteRunspacePoolInternal rsPool, URIDirectionReported 
                              uriRedirectionHandler)
                                 at System.Management.Automation.Internal.ClientRunspacePoolDataStructureHandler.CreateClientRemoteSession(RemoteRunspacePoolInternal 
                              rsPoolInternal)
                                 at System.Management.Automation.Internal.ClientRunspacePoolDataStructureHandler..ctor(RemoteRunspacePoolInternal clientRunspacePool, TypeTable 
                              typeTable)
                                 at System.Management.Automation.Runspaces.Internal.RemoteRunspacePoolInternal.CreateDSHandler(TypeTable typeTable)
                                 at System.Management.Automation.Runspaces.Internal.RemoteRunspacePoolInternal..ctor(Int32 minRunspaces, Int32 maxRunspaces, TypeTable 
                              typeTable, PSHost host, PSPrimitiveDictionary applicationArguments, RunspaceConnectionInfo connectionInfo, String name)
                                 at System.Management.Automation.Runspaces.RunspacePool..ctor(Int32 minRunspaces, Int32 maxRunspaces, TypeTable typeTable, PSHost host, 
                              PSPrimitiveDictionary applicationArguments, RunspaceConnectionInfo connectionInfo, String name)
                                 at System.Management.Automation.RemoteRunspace..ctor(TypeTable typeTable, RunspaceConnectionInfo connectionInfo, PSHost host, 
                              PSPrimitiveDictionary applicationArguments, String name, Int32 id)
                                 at Microsoft.PowerShell.Commands.EnterPSSessionCommand.CreateTemporaryRemoteRunspace(PSHost host, WSManConnectionInfo connectionInfo)
                                 at Microsoft.PowerShell.Commands.EnterPSSessionCommand.CreateRunspaceWhenComputerNameParameterSpecified()
Message                     : This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system.
Data                        : {}
InnerException              : System.DllNotFoundException: Unable to load shared library 'libpsrpclient' or one of its dependencies. In order to help diagnose loading problems, 
                              consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(liblibpsrpclient, 1): image not found
                                 at System.Management.Automation.Remoting.Client.WSManNativeApi.WSManInitialize(Int32 flags, IntPtr& wsManAPIHandle)
                                 at System.Management.Automation.Remoting.Client.WSManClientSessionTransportManager.WSManAPIDataCommon..ctor()
HelpLink                    : 
Source                      : System.Management.Automation
HResult                     : -2146233087

Environment data

Name                           Value
                        
PSVersion                      7.1.1
PSEdition                      Core
GitCommitId                    7.1.1
OS                             Darwin 20.2.0 Darwin Kernel Version 20.2.0: Wed Dec  2 20:40:21 PST 2020; root:xnu-7195.60.75~1/RELEASE_ARM64_T8101
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

  • Apple MacBook Air (M1, 2020)
  • MacOS Big Sur 11.1

Questions

  • Is this a PowerShell problem or an OpenSSL problem?
  • Since OpenSSL1.1.1i is compatible with Big Sur on M1 silicon, is there a workaround to this right now?

Thanks!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:21

github_iconTop GitHub Comments

3reactions
kai-hcommented, Feb 18, 2021

Using these details, I was able to successfully establish a remote session to MS365 from an M1 MacBook Pro. I installed the x86_64 package of PowerShell, installed the native version of MacPorts, and then installed a universal version of OpenSSH 1.0. I created the symlink as detailed above and then could successfully connect to MS365 / Exchange Online (but not using MFA, only legacy auth)

3reactions
jborean93commented, Feb 11, 2021

Is this a PowerShell problem or an OpenSSL problem?

Somewhat PowerShell but also other teams in Microsoft unrelated to PowerShell. The current problem is that the libmi.dylib library shipped by PowerShell is hardcoded to link against OpenSSL 1.0.x. You would need to compile another version that is linked against OpenSSL 1.1.x and then use that library. I’ll touch on this more.

Since OpenSSL1.1.1i is compatible with Big Sur on M1 silicon, is there a workaround to this right now?

The only workaround would be to compile the mi library again yourself that is linked to OpenSSL 1.1.x. You can adjust the link paths of the existing libmi.dylib to link to OpenSSL 1.1.x but when you go to use it there will be failures because 1.0.x and 1.1.x are not fully ABI/API compatible.

I don’t think this is going to be possible for it to be done using the provided library that is included with PowerShell as the team that is involved with maintaining libmi aren’t interested in macOS anymore:

thanks for PR! but omi has dropped powershell and mac support on 2018, and it is only used by SCOM and OMS/LAD now.

The chances of you getting them to create a build for macOS for their MI architecture is probably just as high as getting them to create an OpenSSL 1.1.x one 😃

Once you sort that out then you need to have an updated version of libpsrpclient built for the M1 architecture but that has stayed largely static because libmi has not changed at all.

What you could try is PSWSMan which is my own personal fork of both libmi and libpsrpclient that fixes a few of the problems of the official Microsoft version:

# Needs to be run as sudo or an account that can modify the pwsh install dir
Install-Module -Name PSWSMan
Install-WSMan

# Restart pwsh for it to use the new libraries that have just been installed

As well as fixing the dep on OpenSSL that is a problem on the original there are numerous other fixes that are included to make WSMan on Linux hopefully a better experience.

While this fork works for macOS on Intel I’m unsure whether it will work for M1. I’ve got no hardware to test this and it doesn’t look like M1 is provided with any CI providers so I cannot build or test any copies for that architecture. It’s especially complex as with Rossetta 2 it may just work but I have no idea whether the whole stack needs to be the same architecture or not.

If the forked copy in PSWSMan does not work you can compile your own version:

git clone https://github.com/jborean93/omi
cd omi

# See the steps that the build script will run
./build.py macOS --output-script

# Actually build it
./build.py macOS

I honestly have no idea if this will work or not but if you are willing to try it out I’m more than happy for you to post any relevant info to my fork for anybody else wanting to try it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PowerShell: Install The Microsoft 365 Admin Modules on ...
PowerShell: Install The Microsoft 365 Admin Modules on Apple Silicon MacBooks ... It is used to facilitate PowerShell remoting.
Read more >
Enable-PSRemoting (Microsoft.PowerShell.Core)
The Enable-PSRemoting cmdlet configures the computer to receive PowerShell remote commands that are sent by using the WS-Management technology.
Read more >
People that want to run Windows on Apple computers, why?
I wanted to get a MacBook Pro with an M1 but I found out that all the software I need for Uni either...
Read more >
Check For Psremoting
PSRemoting Support for Apple M1 Silicon - Issue #14760. Cloud Health Check. Share buttons for WordPress including the AddToAny sharing button, Facebook, ...
Read more >
PowerShell and remote sessions to Office 365 / Microsoft 365 ...
PowerShell and remote sessions to Office 365 / Microsoft 365 on Apple Silicon. I've recently switched over to an Apple Silicon MacBook Pro ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found