Title: macOS can't use New-PSSession to Connect to O365 from PowerShell Host - WSMAN client library not found · Issue #10600 · PowerShell/PowerShell · GitHub
Open Graph Title: macOS can't use New-PSSession to Connect to O365 from PowerShell Host - WSMAN client library not found · Issue #10600 · PowerShell/PowerShell
X Title: macOS can't use New-PSSession to Connect to O365 from PowerShell Host - WSMAN client library not found · Issue #10600 · PowerShell/PowerShell
Description: Steps to reproduce Same issue as described here: #5561 except when using Microsoft.PowerShell.SDK (6.2.3) instead of PowerShell CLI Create a netcoreapp2.2 console application on Mac OS Mojave Add PackageReference to Microsoft.PowerShell....
Open Graph Description: Steps to reproduce Same issue as described here: #5561 except when using Microsoft.PowerShell.SDK (6.2.3) instead of PowerShell CLI Create a netcoreapp2.2 console application on Mac OS Mojave Add P...
X Description: Steps to reproduce Same issue as described here: #5561 except when using Microsoft.PowerShell.SDK (6.2.3) instead of PowerShell CLI Create a netcoreapp2.2 console application on Mac OS Mojave Add P...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/10600
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"macOS can't use New-PSSession to Connect to O365 from PowerShell Host - WSMAN client library not found","articleBody":"# Steps to reproduce\r\n\r\nSame issue as described here:\r\nhttps://github.com/PowerShell/PowerShell/issues/5561\r\n\r\nexcept when using Microsoft.PowerShell.SDK (6.2.3) instead of PowerShell CLI\r\n\r\n- Create a netcoreapp2.2 console application on Mac OS Mojave\r\n- Add PackageReference to Microsoft.PowerShell.SDK (6.2.3)\r\n- Add code to connect to O365:\r\n```\r\n var rs = RunspaceFactory.CreateRunspace();\r\n rs.Open();\r\n using (var ps = System.Management.Automation.PowerShell.Create())\r\n {\r\n ps.Runspace = rs;\r\n var initializationScript = $@\"\r\n$ErrorActionPreference = 'Stop'\r\ntry {{ Set-ExecutionPolicy Unrestricted }} catch {{}} # not supported on non-Windows platforms\r\n$UserCredential = New-Object System.Management.Automation.PSCredential('******', (ConvertTo-SecureString '******' -AsPlainText -Force))\r\n$Option = New-PSSessionOption\r\n$Option.IdleTimeout = [TimeSpan]::FromSeconds(60) # inline setting of this property via New-PSSessionOption is not supported on non-Windows platforms\r\n$Session = New-PSSession -SessionOption $Option -ConfigurationName Microsoft.Exchange -ConnectionUri 'https://outlook.office365.com/powershell-liveid/' -Credential $UserCredential -Authentication Basic -AllowRedirection\r\nImport-Module (Import-PSSession $Session -DisableNameChecking) -Global\r\n\";\r\n await ps.AddScript(initializationScript).InvokeAsync();\r\n }\r\n\r\n```\r\n\r\nError:\r\n\r\n```\r\nUnhandled Exception: System.AggregateException: One or more errors occurred.\r\n(This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system.) ---> System.Management.Automation.CmdletInvocationException: This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system. ---> \r\nSystem.Management.Automation.Remoting.PSRemotingTransportException: This parameter set requires WSMan, and no supported WSMan client library was found. WSMan is either not installed or unavailable for this system. ---> 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\r\n at System.Management.Automation.Remoting.Client.WSManNativeApi.WSManInitialize(Int32 flags, IntPtr& wsManAPIHandle)\r\n at System.Management.Automation.Remoting.Client.WSManClientSessionTransportManager.WSManAPIDataCommon..ctor()\r\n \r\n```\r\n\r\nIf I set DYLD_PRINT_LIBRARIES to 1, I see the following when running from C# right before the error:\r\n```\r\ndyld: loaded: /Users/jeff/.nuget/packages/microsoft.powershell.native/6.2.0/runtimes/osx/native/libpsrpclient.dylib\r\ndyld: unloaded: /Users/jeff/.nuget/packages/microsoft.powershell.native/6.2.0/runtimes/osx/native/libpsrpclient.dylib\r\n\r\n```\r\n\r\nWorks:\r\n\r\n- Install PowerShell CLI (6.4.0) (on the exact same machine)\r\n- Run ```sudo ln -s /opt/local/lib /usr/local/opt/openssl/lib``` (this doesn't seem to help the C# code any)\r\n- Run the exact same script\r\n\r\nIf I set DYLD_PRINT_LIBARIES to 1 for the CLI, I see the following right before the connection succeeds:\r\n\r\n```\r\ndyld: loaded: /usr/local/microsoft/powershell/6/libpsrpclient.dylib dyld: loaded: /usr/local/microsoft/powershell/6/libmi.dylib dyld: loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib dyld: loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib \r\n```\r\n\r\nso the problem is specific to the SDK...and the ln command fix doesn't seem to work for the SDK.\r\n\r\n# Expected behavior\r\n\r\nDoesn't throw error\r\n\r\n# Actual behavior\r\n\r\nThrows error \r\n\r\n# Environment data\r\n\r\nMac OS Mojave","author":{"url":"https://github.com/jnevins-gcm","@type":"Person","name":"jnevins-gcm"},"datePublished":"2019-09-23T16:44:01Z","url":"https://github.com/PowerShell/PowerShell/issues/10600"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:fb12f2e3-3b33-43e6-e35a-f588ec1501c1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C770:3B3584:1F2BFF:29B98A:6AFD448F |
| html-safe-nonce | e0a530962e2249a0027797e23b60a25cd08c0c7e0ccd4980136691a44ac40054 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNzcwOjNCMzU4NDoxRjJCRkY6MjlCOThBOjZBRkQ0NDhGIiwidmlzaXRvcl9pZCI6IjQ5NjgzOTcxNjc0MTc3MDU2MTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b267239afe392e4d294d61645a795beeab4b4b24f2aea497024b89f31be0176e |
| hovercard-subject-tag | issue:497209797 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/10600/issue_layout |
| twitter:image | https://opengraph.githubassets.com/edad8c6d714699596c318489a5964fcf44d130afbde2bd28717d090f05efe310/PowerShell/PowerShell/issues/10600 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/edad8c6d714699596c318489a5964fcf44d130afbde2bd28717d090f05efe310/PowerShell/PowerShell/issues/10600 |
| og:image:alt | Steps to reproduce Same issue as described here: #5561 except when using Microsoft.PowerShell.SDK (6.2.3) instead of PowerShell CLI Create a netcoreapp2.2 console application on Mac OS Mojave Add P... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jnevins-gcm |
| hostname | github.com |
| expected-hostname | github.com |
| None | bdbacc25b921224ff0befcb9e629560a1255be51aec9991d6e3f95b5e9151474 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 556dd37bb0aceffb25724e151b5d858b3265b40b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width