After upgrading Microsoft Graph, I noticed an issue when trying to run cmdlet Get-MgGroup or Get-MgUser. I could connect to Graph with no issues, but multiple cmdlets failed.
Error
Get-MgGroup : Could not load type 'Microsoft.Graph.Authentication.AzureIdentityAccessTokenProvider' from assembly 'Microsoft.Graph.Core, Version=1.25
.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
At line:1 char:1
+ Get-MgGroup -All
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-MgGroup_List], TypeLoadException
+ FullyQualifiedErrorId : Microsoft.Graph.PowerShell.Cmdlets.GetMgGroup_List
This command did also fail
[Microsoft.Graph.Authentication.AzureIdentityAccessTokenProvider]
CategoryInfo : InvalidOperation: (Microsoft.Graph…ssTokenProvider:TypeName) [], RuntimeException
FullyQualifiedErrorId : TypeNotFound
Root Cause
Even though Microsoft Graph v2.2 installed the version 3.0.9.0 of Microsoft.Graph.Core.Dll, there were multiple versions of Microsoft.Graph.Core.dll found in the $Env:PsModulePath path.

A search found multiple older versions (1.11, 1.24, 1.25) of Microsoft.Graph.Core.dll related to PnP.Powershell module.

Resolution
Remove older versions of Pnp.Powershell (or other Powershell-modules having old DLLs)
uninstall-module -Name PnP.PowerShell -AllVersions
Issue: Uninstall – Module x is currently in use ….
If you see the below error, it is caused by a dependent DLL being loaded as part of the shell / session and therefore in use.

Solution: Module x is currently in use ….
Method 1: Remove-Module + Uninstall-Module
Run the Remove-Module first to unload the imported module from memory.
After this you can do an uninstall-module
Remove-Module -Name <ModuleName> -force
Uninstall-Module -Name <ModuleName> -force
Method 2: Start a CMD and then a Powershell with -NoProfile
(1) Close all running Powershell sessions
(2) Start a CMD as local admin
(3) Run the below Powershell-command with the -NoProfile and -NonInteractive. Powershell will now be started, without loading any DLLs into the session.
C:\>powershell -NoProfile -NonInteractive -Command "uninstall-module -Name PnP.PowerShell -AllVersions"
