Prerequisites
The PowerShellModuleName variable must already be defined or one of the following values must be set:
Install the PowerShell module
Run the following commands to verify the NuGet provider is installed:
Find-PackageProvider -Name 'NuGet' -Force -ForceBootstrap
Run the following commands to trust the PSGallery:
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted
Modify then run the following commands to define the name of the PowerShell module:
If ([string]::IsNullOrEmpty($PowerShellModuleName)) { $PowerShellModuleName = 'ExchangeOnlineManagement' }
Run the following commands to locate the PowerShell modules:
$Found = Get-Module -Name $PowerShellModuleName -ListAvailable
Run the following commands to unload the PowerShell modules
Remove-Module -Name $PowerShellModuleName -Force
Run the code blocks in one of the following sections to update or install the latest version of the PowerShell modules from the PSGallery:
To install the module:
Install-Module -Name $PowerShellModuleName
To update the module:
Update-Module -Name $PowerShellModuleName