Sharepoint Online Powershell Module

Check

Check the version installed on the Host Computer

Get-Module -Name Microsoft.Online.SharePoint.PowerShell -ListAvailable | Select Name,Version

Nothing will be printed if not installed

Install

Run PowerShell as Administrator

Install-Module Microsoft.Online.SharePoint.PowerShell 
If NuGet provider is not installed will ask to install

After Confirming :Y the green installing message will appear for just a moment as package is only a few MB
*If Administrative Privileges are not granted on the system the module can be installed for current user

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

ReInstall

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

Update

Update-module microsoft.online.sharepoint.powershell

Uninstall

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

Check Modules

Get-command -Module Microsoft.Online.SharePoint.PowerShell

Sample PowerShell Script

#Check if SharePoint Online PowerShell module has been installed
Try {
    Write-host "Checking if SharePoint Online PowerShell Module is Installed..." -f Yellow -NoNewline
    $SharePointOnlineModule = Get-Module -ListAvailable "Microsoft.Online.SharePoint.PowerShell"
 
    If(!$SharePointOnlineModule)
    {
        Write-host "No!" -f Green
 
        #Check if script is executed under elevated permissions - Run as Administrator
        If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
        {  
            Write-Host "Please Run this script in elevated mode (Run as Administrator)! " -NoNewline
            Read-Host "Press any key to continue"
            Exit
        }
 
        Write-host "Installing SharePoint Online PowerShell Module..." -f Yellow -NoNewline
        Install-Module "Microsoft.Online.SharePoint.PowerShell" -Force -Confirm:$False
        Write-host "Done!" -f Green
    }
    Else
    {
        Write-host "Yes!" -f Green
        #sharepoint online powershell module import
        Write-host "Importing SharePoint Online PowerShell Module..." -f Yellow  -NoNewline
        Import-Module "Microsoft.Online.SharePoint.PowerShell" -DisableNameChecking
        Write-host "Done!" -f Green
    }
}
Catch{
    write-host "Error: $($_.Exception.Message)" -foregroundcolor red
}


Read more: https://www.sharepointdiary.com/2018/12/install-update-uninstall-sharepoint-online-powershell-module.html#ixzz7AHzuJAGZ