Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Prerequisites

The PowerShellModuleName variable must already be defined or one of the following values must be set:

Expand
titleCommon PowerShell module names
Info

Exchange Online

Code Block
languagepowershell
$PowerShellModuleName = 'ExchangeOnlineManagement'

Install the PowerShell module

Run the following commands to verify the NuGet provider is installed:

Code Block
languagepowershell
Find-PackageProvider -Name 'NuGet' -Force -ForceBootstrap

Modify then run Run the following commands to define the name of the PowerShell module trust the PSGallery:

Code Block
languagepowershell
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted

Run the following commands to locate the active PowerShell modules:

Code Block
languagepowershell
$ModuleIsActive = Get-Module -Name $PowerShellModuleName

Run the following commands to locate the installed PowerShell modules

Code Block
$ModuleIsInstalled = 'ExchangeOnlineManagement' Get-Module -Name $PowerShellModuleName -ListAvailable

Run the following commands to unload the PowerShell modules

Code Block
languagepowershell
If ($ModuleIsActive) { Remove-Module -Name $PowerShellModuleName -Force }

Run the code blocks in one of the following sections commands to update or install the latest version of the Graph PowerShell modules from the PSGallery: 

To update or install the module:

Code Block
languagepowershell
If ($ModuleIsInstalled) { Update-Module -Name $PowerShellModuleName } Else { Install-Module -Name $PowerShellModuleName }