Prerequisites
The PowerShellModuleName variable must already be defined or one of the following values must be set:
Expand |
---|
title | Common PowerShell module names |
---|
|
Code Block |
---|
| $PowerShellModuleName = 'ExchangeOnlineManagement' |
|
Install the PowerShell module
Run the following commands to verify the NuGet provider is installed:
Code Block |
---|
|
Find-PackageProvider -Name 'NuGet' -Force -ForceBootstrap |
Run the following commands to define the name of the PowerShell module trust the PSGallery:
Code Block |
---|
|
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted |
Run the following commands to locate the active PowerShell modules:
Code Block |
---|
|
$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 |
---|
|
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:
...
Code Block |
---|
|
If ($ModuleIsInstalled) { Update-Module -Name $PowerShellModuleName |
...
To install or reinstall the modules:
...
...
} Else { Install-Module - |
...
Name $PowerShellModuleName |
...