SharePoint Online PowerShell – Resolving error – Import-Module: Could not load type ‘Microsoft.Online.SharePoint.TenantAdministration.OptInReportEntityEnum’ from assembly ‘Microsoft.Online.SharePoint.Client.Tenant, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’

Error while executing "Import-Module" CMDLET
Error while executing "Import-Module" CMDLET

Hi All,

Greetings for the day!

Today new issue and solution!

Background

  • I want to execute few SharePoint Online PowerShell CMDLETs.
  • To execute SharePoint Online PowerShell CMDLETs, I was importing SharePoint Online PowerShell module – Microsoft.Online.SharePoint.PowerShell using Import-Module CMDLET

Import-Module Microsoft.Online.SharePoint.PowerShell

  • While executing above CMDLET we were getting an error.

Error

Import-Module: Could not load type ‘Microsoft.Online.SharePoint.TenantAdministration.OptInReportEntityEnum’ from assembly ‘Microsoft.Online.SharePoint.Client.Tenant, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’.

Error message displayed in a PowerShell terminal related to importing the SharePoint Online PowerShell module, indicating a type loading issue.
figure: Error while executing “Import-Module” CMDLET

Solution

  • After bit googling found simple steps.
  • Uninstall the module and install again.
  • Uninstalling the module

Uninstall-Module -Name Microsoft.Online.SharePoint.PowerShell -AllVersions

  • Once module uninstalled successfully, we will install the module again.

Install-Module -Name Microsoft.Online.SharePoint.PowerShell

  • As SharePoint Online PowerShell module installed successfully, we are able to import the module successfully as shown in figure below
PowerShell terminal displaying commands to uninstall and install the SharePoint Online PowerShell module, along with a warning about untrusted repository.
figure: Uninstalling and installing SharePoint Online PowerShell module – Microsoft.Online.SharePoint.PowerShell

REFERENCES

Thanks for reading!!!

HAVE A FANTASTIC TIME AHEAD !!! LIFE IS BEAUTIFUL 🙂

Prasham Sabadra

LIFE IS VERY BEAUTIFUL. ENJOY THE WHOLE JOURNEY :) Founder of Microsoft 365 Junction, Speaker, Author, Learner, Developer, Passionate Techie. Certified Professional Workshop Facilitator / Public Speaker. Believe in knowledge sharing. Around 20+ years of total IT experience and 17+ years of experience in SharePoint and Microsoft 365 services Please feel free me to contact for any SharePoint / Microsoft 365 queries. I am also very much interested in behavioral (life changing) sessions like motivational speeches, Success, Goal Setting, About Life, How to live Life etc. My book - Microsoft 365 Power Shell hand book for Administrators and Beginners and 100 Power Shell Interview Questions - https://www.amazon.in/Microsoft-Administrators-Beginners-Interview-Questions/dp/9394901639/ref=tmm_pap_swatch_0?_encoding=UTF8&qid=1679029081&sr=8-11

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Microsoft 365

Subscribe now to keep reading and get access to the full archive.

Continue reading