Get-MgUser returns an error

OLIVEIRA Fernando EXT 0 Reputation points
2025-05-21T14:03:25.0133333+00:00

I keep getting an error when runing Get-MgUser:

The 'Get-MgUser' command was found in the module 'Microsoft.Graph.Users', but the module could not be loaded due to the following error: [Could not load file or assembly 'Microsoft.Graph.Authentication, Version=2.20.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Assembly with same name is already loaded]

For more information, run 'Import-Module Microsoft.Graph.Users'.

Can someone please help me solving this?
Thank you

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Andy David - MVP 157.6K Reputation points MVP Volunteer Moderator
    2025-05-21T14:12:22.79+00:00

    Whenever I see this, I find that completely removing the module and reinstalling is the quickest and best fix. ( and remove any mggraph modules directories on disk as well if the steps below dont remove those when uninstalling)

    https://learn.microsoft.com/en-us/powershell/microsoftgraph/installation?view=graph-powershell-1.0

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.