Versions Compared

Key

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

Run the

...

Update modules:

...

Info

This will perform the following actions for each PowerShell module:

  • Remove the modules from the current session if loaded
  • Update the module if installed and install the module if not
  • Uninstall any previous versions of the module

Unload Graph PowerShell modules respecting dependency on Microsoft.Graph.Authentication 

following commands to verify the NuGet provider is installed:

Code Block
languagepowershell

...

Find-PackageProvider -Name 'NuGet' -Force -ForceBootstrap

Run the following commands to trust the PSGallery:

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

Run the following commands to define the names of the Graph PowerShell module collection and of any modules that are a dependency for other modules the collection:

Code Block
languagepowershell

...

$PowerShellModuleName = 'Microsoft.Graph'
$DependsOnModuleNames 

...

Reinstall modules 

...

Info

This will perform the following actions for each PowerShell module:

  • Remove the modules from the current session if loaded
  • Remove the module files from the AllUsers scope
  • Install the modules from the PowerShell gallery

...

= 'Microsoft.Graph.Authentication'

Run the following commands to split the Graph PowerShell modules based upon the module dependencies:

Code Block
languagepowershell

...

$Modules, 

...

$Dependencies = (Get-Module -Name 

...

"$PowerShellModuleName.

...

*

...

").Where({$_.Name -

...

notin $DependsOnModuleNames},[System.Management.Automation.WhereOperatorSelectionMode]::Split)

...

Run the following commands to unload the Graph PowerShell modules respecting the module dependencies:

Code Block
languagepowershell
$Modules | ForEach-Object { Remove-Module -Name $_.Name -Force }; 

...

$Dependencies | ForEach-Object { Remove-Module -Name $_.Name -Force }

...

Remove Graph PowerShell modules 

...

Run the following commands to remove the Graph PowerShell modules currently installed:

Code Block
Get-ChildItem -Path "$env:ProgramFiles\WindowsPowerShell\Modules" -Filter 

...

"$PowerShellModuleName*" | Remove-Item -

...

Force -

...

Recurse

Run the following commands to install the latest version of the Graph PowerShell modules from the PSGallery: 

Code Block
languagepowershell
Save-Module -Path "$env:ProgramFiles\WindowsPowerShell\Modules" -Name 

...

$PowerShellModuleName -Force