Powershell: Cannot Import-Module MSOnline

Created on 12 May 2017  路  7Comments  路  Source: PowerShell/PowerShell

Does this module use the full .NET Framework?

Steps to reproduce

PS /Users/tplants> Import-Module MSOnline                                                                                                                         
Import-Module : Could not load file or assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find 
the file specified.
At line:1 char:1
+ Import-Module MSOnline
+ ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Import-Module], FileNotFoundException
    + FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.ImportModuleCommand

Expected behavior

Module installs and is ready to use.

Actual behavior

Module does not install.

Environment data

PS /Users/tplants> $PSVersionTable                                                                                                                                

Name                           Value                                                                                                                             
----                           -----                                                                                                                             
PSVersion                      6.0.0-beta                                                                                                                        
PSEdition                      Core                                                                                                                              
BuildVersion                   3.0.0.0                                                                                                                           
CLRVersion                                                                                                                                                       
GitCommitId                    v6.0.0-beta.1                                                                                                                     
OS                             Darwin 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar  3 16:52:33 PST 2017; root:xnu-3789.51.2~3/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                                                                                                                               
Issue-Question Resolution-Answered

Most helpful comment

The best thing to do is to ask the Office365 team to make their cmdlets PSCore6 compatible https://office365.uservoice.com/

All 7 comments

Does this module use the full .NET Framework?

Yes, looks like so.
PSv5 (Windows PowerShell)

PS:22> Add-Type -AssemblyName System.ServiceModel
PS:23> [System.ServiceModel.EndpointIdentity].Assembly.FullName
System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

PSv6.beta.1 (PowerShell Core)

PS:8> [System.ServiceModel.EndpointIdentity].Assembly.FullName
System.Private.ServiceModel, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

And the APIs under System.ServiceModel namespace are not in netstandard2.0 (see the API list here). That means this module won't automatically work on .NET Core.

That's too bad for my specific use case today! 馃榿

Thanks for the help.

Hi, Any resolution for this problem, I need administrate my Office365 from my Linux for monitor in Zabbix. The module install but dont load.
`PS /opt/microsoft/powershell/6.0.0-beta.1/Modules/MSOnline/1.1.166.0> Import-Module MSOnline
Import-Module : Could not load file or assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the
file specified.
At line:1 char:1

  • Import-Module MSOnline
  • ~~~~~~

    • CategoryInfo : NotSpecified: (:) [Import-Module], FileNotFoundException

    • FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.ImportModuleCommand

      `

      Thanks.

The best thing to do is to ask the Office365 team to make their cmdlets PSCore6 compatible https://office365.uservoice.com/

Thanks @SteveL-MSFT .

Was this page helpful?
0 / 5 - 0 ratings