problem to connect MsolService

Hi ,

While connecting to MsolService  through  azur powershell getting error ( Connect-MsolService –Credential $cred )

Connect-MsolService : Method not found: 'Void
System.Runtime.InteropServices.Marshal.PtrToStructure(IntPtr, !!0)'.
At line:1 char:1
+ Connect-MsolService -Credential $cred
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [Connect-MsolService], Mis
   singMethodException
    + FullyQualifiedErrorId : System.MissingMethodException,Microsoft.Online.A
   dministration.Automation.ConnectMsolService

 

Question Info


Last updated November 12, 2019 Views 4,515 Applies to:
Answer
Answer
Hi Satya11,

About the issue, may I know if you connect to Office 365 PowerShell via the following steps? If not, could you try it to see if there is any improvement?

1. Install the Microsoft Online Services Sign-in Assistant via Microsoft Online Services Sign-in Assistant for IT Professionals RTW.
2. Install the latest version of Windows Azure Active Directory Module for Windows PowerShell:
Windows Azure Active Directory Module for Windows PowerShell(64-bit version)
Windows Azure Active Directory Module for Windows PowerShell (32-bit version)
3. Install Microsoft .NET Framework 4.5.2 from the link: https://www.microsoft.com/en-sg/download/details.aspx?id=42642 .
4. Open Windows Azure Active Directory Module for Windows PowerShell installed above and connect to your Office 365 subscription via the command: Connect-MsolService to check the result.

In addition, more information can be found in the articles: Azure Active Directory Cmdlets and Connect to Office 365 PowerShell.

If the issue persists, to clarify the scenario, could you confirm the following details?

1. Which operating system are you using? Do you run into the error on Windows7 computer?
2. Have you installed the Microsoft .NET Framework 4.5.2 or a higher version on your computer?
3. Could you share with us a screenshot about the error message? To insert picture, please click Insert Image icon when replying the post.

Regards,
Shirley

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.