Versions Compared

Key

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

...

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

Modify then run Run the following commands to define locate the name of the loaded PowerShell modulemodules:

Code Block
languagepowershell
If ([string]::IsNullOrEmpty($PowerShellModuleName)) { $PowerShellModuleName = 'ExchangeOnlineManagement' }$Loaded = Get-Module -Name $PowerShellModuleName

Run the following commands to locate the installed PowerShell modules :

Code Block
languagepowershell
$Found$Installed = Get-Module -Name $PowerShellModuleName -ListAvailable

...

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

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

To install the module:

Code Block
languagepowershell

...

If ($Installed) { Update-Module -Name $PowerShellModuleName 

...

To update the module:

...

languagepowershell

...

} Else { Install-Module -Name $PowerShellModuleName }