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 |
Modify then run the following commands to define the name Run the following commands to trust the PSGallery:
| Code Block |
|---|
|
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted |
Run the following commands to locate any installed instance of the PowerShell module
| Code Block |
|---|
|
$ModuleIsInstalled = Get-Module -Name $PowerShellModuleName -ListAvailable |
Run the following commands to locate any active instance of the PowerShell module:
| Code Block |
|---|
|
$PowerShellModuleName$ModuleIsActive = 'ExchangeOnlineManagement' Get-Module -Name $PowerShellModuleName |
Run the following commands to unload any active instance of the PowerShell modulesmodule
| 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 module from the PSGallery:
...
| Code Block |
|---|
|
If ($ModuleIsInstalled) { Update-Module -Name $PowerShellModuleName |
...
To install or reinstall the modules:
...
...
-Verbose } Else { Install-Module -Name $PowerShellModuleName - |
...