Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Import-module MSOnline error reporting solution

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

A problem encountered today, in fact, has been encountered before, that is, it has not been solved after looking for documents for a long time. The specific error messages are as follows:

PS C:\ > Import-Module MSOnline

Import-Module: Could not load file or assembly 'file:///C:\Program

Files\ WindowsPowerShell\ Modules\ MSOnline\ 1.1.183.17\ Microsoft.Online.Administration.Automation.PSModule.dll' or one of

Its dependencies. An attempt was made to load a program with an incorrect format.

At line:1 char:1

Import-Module MSOnline+ CategoryInfo: InvalidOperation: (:) [Import-Module], BadImageFormatException+ FullyQualifiedErrorId: FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand! [] (https://s1.51cto.com/images/blog/201907/20/7472219814a51e465f4a9bdac902942e.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)

Windows Management framework 5.1 is installed automatically after winndows 10.

The reference materials given on the official website are:

Https://docs.microsoft.com/en-us/office365/enterprise/powershell/connect-to-office-365-powershell

One component that needs to be installed is Microsoft Online Services Sign-in Assistant for IT Professionals RTW, which I also installed.

Then run the command: install-module-name AzureAD

This command also runs successfully, but an error occurs when you run import-module MSOnline.

The stupidest way is to copy all the files in C:\ Program Files (x86)\ WindowsPowerShell\ Modules to C:\ Windows\ SysWOW64\ WindowsPowerShell\ v1.0\ Modules

And then run it again, found or failed, I was almost dizzy with anger. The framework is also available, and the certified component is also installed, but it still doesn't work. Because I am used to using POWERSHELL ISE to do my work, I just open ISE and do it again. One of them is to change Set-ExecutionPolicy to Unrestricted.

Then I operated like a tiger in ISE, and the problem was solved. In fact, in retrospect, it is caused by the POWERSHELL version, and the system is mixed up with 64-bit and X86 by default. Anyway, as long as I can use it, I don't care why the POWERSHELL X64 just can't be used.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report