You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 4
Next »
Run the code blocks in one of the following sections to install the latest version of the Microsoft Graph PowerShell modules from the PSGallery:
Update modules:
Click here to expand...
Unload Graph PowerShell modules respecting dependency on Microsoft.Graph.Authentication
# get loaded Graph modules
$MgAuthn, $MgGraph = (Get-Module -Name Microsoft.Graph*).Where({$_.Name -eq 'Microsoft.Graph.Authentication'},[System.Management.Automation.WhereOperatorSelectionMode]::Split)
# unload Graph modules with Authn last
$MgGraph | ForEach-Object { Remove-Module -Name $_.Name -Force }; $MgAuthn | ForEach-Object { Remove-Module -Name $_.Name -Force }
Update Graph PowerShell modules
Update-Module -Name Microsoft.Graph
Reinstall modules
Click here to expand...
Unload Graph PowerShell modules respecting dependency on Microsoft.Graph.Authentication
# get loaded Graph modules
$MgAuthn, $MgGraph = (Get-Module -Name 'Microsoft.Graph*').Where({$_.Name -eq 'Microsoft.Graph.Authentication'},[System.Management.Automation.WhereOperatorSelectionMode]::Split)
# unload Graph modules with Authn last
$MgGraph | ForEach-Object { Remove-Module -Name $_.Name -Force }; $MgAuthn | ForEach-Object { Remove-Module -Name $_.Name -Force }
Remove Graph PowerShell modules
Get-ChildItem -Path "$env:ProgramFiles\WindowsPowerShell\Modules" -Filter 'Microsoft.Graph*' | Remove-Item -Recurse -Force
Install Graph PowerShell modules
Save-Module -Path "$env:ProgramFiles\WindowsPowerShell\Modules" -Name Microsoft.Graph -Force