How can I get my SharePoint Online Management Module working in PowerShell?

Rose Fletcher 25 Reputation points
2023-05-01T13:06:48.1533333+00:00
(1) Trying to run any SPO command getting:

Connect-SPOService : The term 'Connect-SPOService' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

At line:1 char:2

+  Connect-SPOService

+  ~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : ObjectNotFound: (Connect-SPOService:String) [], CommandNotFoundException

    + FullyQualifiedErrorId : CommandNotFoundException

(2)  I have verified that the SPO Module is installed:

PS C:\WINDOWS\system32> Get-Module -Name Microsoft.Online.SharePoint.PowerShell -ListAvailable | Select Name,Version 

 

Name                                   Version         

----                                   -------         

Microsoft.Online.SharePoint.PowerShell 16.0.23508.12000

Microsoft.Online.SharePoint.PowerShell 16.0.23508.0    

(3) I have uninstalled the module:

Uninstalled the Powershell Module:

  PS C:\WINDOWS\system32> Uninstall-Module -Name Microsoft.Online.SharePoint.PowerShell -AllVersions -Force

Command completed succesfully.

(4) Reinstalled the modules:

WARNING: Version '16.0.23508.0' of module 'Microsoft.Online.SharePoint.PowerShell' is already installed at 'C:\Program Files\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell'. To install version '16.0.23508.12000', run Install-Module

 and add the -Force parameter, this command will install version '16.0.23508.12000' in side-by-side with version '16.0.23508.0'. 

I did the forced installed and again, shows the versions running.      Any ideas?? 
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,740 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,552 questions
0 comments No comments
{count} votes

Accepted answer
  1. Konstantinos Passadis 19,166 Reputation points MVP
    2023-05-01T13:22:54.5666667+00:00

    Hello @Rose Fletcher

    It's possible that the SharePoint Online Management Shell module was not imported into your PowerShell session before you attempted to use the Connect-SPOService cmdlet.

    Try importing the module first using the Import-Module cmdlet:

    mathematica
    
    Import-Module Microsoft.Online.SharePoint.PowerShell
    

    Then try running the Connect-SPOService cmdlet again.

    If that doesn't work, try uninstalling the SharePoint Online Management Shell module and installing it again using the following steps:

    Open PowerShell as an administrator.

    Run the following command to uninstall the module:

    mathematica
    
    1. Uninstall-Module -Name Microsoft.Online.SharePoint.PowerShell -Force

    Close and reopen PowerShell as an administrator.

    Run the following command to install the latest version of the module:

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

    Import the module by running the following command:

    mathematica
    
    1. Import-Module Microsoft.Online.SharePoint.PowerShell

    Finally, try running the Connect-SPOService cmdlet again.

    If you're still having issues after trying these steps, there may be an issue with your installation of the SharePoint Online Management Shell module, share your feedback

    If the answer helped you kindly mark it as Accepted!

    Regards

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Rose Fletcher 25 Reputation points
    2023-05-01T14:19:55.69+00:00

    Thank you. In the attempts to try and install the module, I was getting additional errors. Import-Module : Could not load type ‘Microsoft.SharePoint.Administration.DesignPackageType’ from assembly ‘Microsoft.SharePoint.Client, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’ I found the answer to that on a different forum: https://www.sharepointdiary.com/2019/02/import-module-could-not-load-type-microsoft-sharepoint-administration-designpackagetype-from-assembly.html

    This is due to the DLL Version mismatch. To resolve the issue, follow these steps:

    Uninstall SharePoint Online Management Shell and SharePoint Online Client SDK if installed.

    Delete SharePoint Online Client Assemblies from: C:\Windows\Microsoft.NET\assembly\GAC_MSIL, remove all Folders starting with name: Microsoft.SharePoint*

    Uninstall the module with “Uninstall-Module -Name Microsoft.Online.SharePoint.PowerShell -AllVersions” and reinstall the module “Install-Module -Name Microsoft.Online.SharePoint.PowerShell”

    Once this was addressed, I was able to load the SPO module. Thank you.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.