msgraph-sdk-powershell icon indicating copy to clipboard operation
msgraph-sdk-powershell copied to clipboard

Issue with Get-MgGroup on PowerShell 5.1

Open desmay opened this issue 3 years ago • 3 comments

I'm getting an issue with the Get-MgGroup when running in PowerShell 5.1

image

The same code works fine in PowerShell 7.2 image

I'm running the following version: image

desmay avatar Apr 07 '22 19:04 desmay

@desmay, could you please share a sanitized -Debug output or the value of -ErrorVariable when Get-MgGroup throws an error in PowerShell 5.1:

$Groups = Get-MgGroup -ErrorVariable GroupError
$GroupError.Exception.ResponseBody

Also, how many groups are you fetching? I can't reproduce this in a tenant with 2000 groups $Groups = Get-MgGroup -All -CountVariable GroupCount -ConsistencyLevel eventual.

peombwa avatar Apr 13 '22 18:04 peombwa

@peombwa There is nothing in ResponseBody looks like error is issue loading assembly image

There are only 199 groups in this tenant. image

desmay avatar Apr 14 '22 12:04 desmay

@peombwa Facing the same issue when using version 1.9.5 and calling the command below. Interestingly this does not happen when i connect as a User. When connecting as a serviceprincipal:

Connect-MgGraph -ClientID $clientID -TenantId $tenantID -CertificateName $certsubject Select-MgProfile -Name beta (Get-MgContext).Scopes

User.ReadWrite.All UserAuthenticationMethod.ReadWrite.All Group.Read.All Directory.ReadWrite.All User.Invite.All User.Read.All AuditLog.Read.All

Get-MgUserAuthenticationPhoneMethod -UserId $userPrincipalName -errorvariable phoneerror $phoneerror.Exception | select *

InnerExceptions : {System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Graph.Authentication.Core, Version=1.9.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.Graph.Authentication.Core, Version=1.9.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at Microsoft.Graph.PowerShell.Module.<OnCmdletBeginProcessing>d__5.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine) at Microsoft.Graph.PowerShell.Module.OnCmdletBeginProcessing(String id, CancellationToken cancellationToken, Func1 getEventData, Func4 signal, InvocationInfo invocationInfo) at Microsoft.Graph.PowerShell.Module.<EventHandler>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Graph.PowerShell.Module.<Signal>d__35.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Graph.PowerShell.Cmdlets.GetMgUserAuthenticationPhoneMethod_List.<Microsoft-Graph-PowerShe ll-Runtime-IEventListener-Signal>d__80.MoveNext()

              WRN: Assembly binding logging is turned OFF.
              To enable assembly bind failure logging, set the registry value 
              [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
              Note: There is some performance penalty associated with assembly bind failure logging.
              To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
              }

Message : One or more errors occurred. Data : {} InnerException : System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Graph.Authentication.Core, Version=1.9.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.Graph.Authentication.Core, Version=1.9.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at Microsoft.Graph.PowerShell.Module.<OnCmdletBeginProcessing>d__5.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine) at Microsoft.Graph.PowerShell.Module.OnCmdletBeginProcessing(String id, CancellationToken cancellationToken, Func1 getEventData, Func4 signal, InvocationInfo invocationInfo) at Microsoft.Graph.PowerShell.Module.<EventHandler>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Graph.PowerShell.Module.<Signal>d__35.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Graph.PowerShell.Cmdlets.GetMgUserAuthenticationPhoneMethod_List.<Microsoft-Graph-PowerShe ll-Runtime-IEventListener-Signal>d__80.MoveNext()

              WRN: Assembly binding logging is turned OFF.
              To enable assembly bind failure logging, set the registry value 
              [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
              Note: There is some performance penalty associated with assembly bind failure logging.
              To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

TargetSite : Void ThrowIfExceptional(Boolean) StackTrace : at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at Microsoft.Graph.PowerShell.Cmdlets.GetMgUserAuthenticationPhoneMethod_List.BeginProcessing() at System.Management.Automation.Cmdlet.DoBeginProcessing() at System.Management.Automation.CommandProcessorBase.DoBegin() HelpLink : Source : mscorlib HResult : -2146233088

InnerExceptions : {System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Graph.Authentication.Core, Version=1.9.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.Graph.Authentication.Core, Version=1.9.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at Microsoft.Graph.PowerShell.Module.<OnCmdletBeginProcessing>d__5.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine) at Microsoft.Graph.PowerShell.Module.OnCmdletBeginProcessing(String id, CancellationToken cancellationToken, Func1 getEventData, Func4 signal, InvocationInfo invocationInfo) at Microsoft.Graph.PowerShell.Module.<EventHandler>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Graph.PowerShell.Module.<Signal>d__35.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Graph.PowerShell.Cmdlets.GetMgUserAuthenticationPhoneMethod_List.<Microsoft-Graph-PowerShe ll-Runtime-IEventListener-Signal>d__80.MoveNext()

              WRN: Assembly binding logging is turned OFF.
              To enable assembly bind failure logging, set the registry value 
              [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
              Note: There is some performance penalty associated with assembly bind failure logging.
              To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
              }

Message : One or more errors occurred. Data : {} InnerException : System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Graph.Authentication.Core, Version=1.9.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.Graph.Authentication.Core, Version=1.9.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at Microsoft.Graph.PowerShell.Module.<OnCmdletBeginProcessing>d__5.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine) at Microsoft.Graph.PowerShell.Module.OnCmdletBeginProcessing(String id, CancellationToken cancellationToken, Func1 getEventData, Func4 signal, InvocationInfo invocationInfo) at Microsoft.Graph.PowerShell.Module.<EventHandler>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Graph.PowerShell.Module.<Signal>d__35.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Graph.PowerShell.Cmdlets.GetMgUserAuthenticationPhoneMethod_List.<Microsoft-Graph-PowerShe ll-Runtime-IEventListener-Signal>d__80.MoveNext()

              WRN: Assembly binding logging is turned OFF.
              To enable assembly bind failure logging, set the registry value 
              [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
              Note: There is some performance penalty associated with assembly bind failure logging.
              To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

TargetSite : Void ThrowIfExceptional(Boolean) StackTrace : at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at Microsoft.Graph.PowerShell.Cmdlets.GetMgUserAuthenticationPhoneMethod_List.BeginProcessing() at System.Management.Automation.Cmdlet.DoBeginProcessing() at System.Management.Automation.CommandProcessorBase.DoBegin() HelpLink : Source : mscorlib HResult : -2146233088

InnerExceptions : {System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Graph.Authentication.Core, Version=1.9.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.Graph.Authentication.Core, Version=1.9.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at Microsoft.Graph.PowerShell.Module.<OnCmdletBeginProcessing>d__5.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine) at Microsoft.Graph.PowerShell.Module.OnCmdletBeginProcessing(String id, CancellationToken cancellationToken, Func1 getEventData, Func4 signal, InvocationInfo invocationInfo) at Microsoft.Graph.PowerShell.Module.<EventHandler>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Graph.PowerShell.Module.<Signal>d__35.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Graph.PowerShell.Cmdlets.GetMgUserAuthenticationPhoneMethod_List.<Microsoft-Graph-PowerShe ll-Runtime-IEventListener-Signal>d__80.MoveNext()

              WRN: Assembly binding logging is turned OFF.
              To enable assembly bind failure logging, set the registry value 
              [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
              Note: There is some performance penalty associated with assembly bind failure logging.
              To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
              }

Message : One or more errors occurred. Data : {} InnerException : System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Graph.Authentication.Core, Version=1.9.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.Graph.Authentication.Core, Version=1.9.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at Microsoft.Graph.PowerShell.Module.<OnCmdletBeginProcessing>d__5.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine) at Microsoft.Graph.PowerShell.Module.OnCmdletBeginProcessing(String id, CancellationToken cancellationToken, Func1 getEventData, Func4 signal, InvocationInfo invocationInfo) at Microsoft.Graph.PowerShell.Module.<EventHandler>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Graph.PowerShell.Module.<Signal>d__35.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Graph.PowerShell.Cmdlets.GetMgUserAuthenticationPhoneMethod_List.<Microsoft-Graph-PowerShe ll-Runtime-IEventListener-Signal>d__80.MoveNext()

              WRN: Assembly binding logging is turned OFF.
              To enable assembly bind failure logging, set the registry value 
              [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
              Note: There is some performance penalty associated with assembly bind failure logging.
              To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

TargetSite : Void ThrowIfExceptional(Boolean) StackTrace : at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at Microsoft.Graph.PowerShell.Cmdlets.GetMgUserAuthenticationPhoneMethod_List.BeginProcessing() at System.Management.Automation.Cmdlet.DoBeginProcessing() at System.Management.Automation.CommandProcessorBase.DoBegin() HelpLink : Source : mscorlib HResult : -2146233088

mrmueller avatar Apr 22 '22 12:04 mrmueller

A follow up on this issue. Is the error still occurring with latest version of the module (1.19.0)? We did change how we reference our dependency in v1.12.2.

We still haven't been able to reproduce the issue on our end.

peombwa avatar Dec 21 '22 17:12 peombwa

I get the same error too.

After running Get-MgGroup , I ran $error[0] | ConvertTo-Json to get the following error details.

    "Exception":  {
                      "InnerExceptions":  [
                                              "System.IO.FileNotFoundException: Could not load file or assembly \u0027Microsoft.Graph.Authentication.Core, Version=1.19.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\u0027 or 
one of its dependencies. The system cannot find the file specified.\r\nFile name: \u0027Microsoft.Graph.Authentication.Core, Version=1.19.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\u0027\r\n   at Microsoft.Graph.PowerShell.Module.\u003cOnCmdletBeginProcessing\u003ed__5.MoveNext()\r\n   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine\u0026 stateMachine)\r\n   at Microsoft.Graph.PowerShell.Module.OnCmdletBeginProcessing(String id, CancellationToken cancellationToken, Func`1 getEventData, Func`4 signal, InvocationInfo invocationInfo)\r\n   at Microsoft.Graph.PowerShell.Module.\u003cEventHandler\u003ed__4.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.Graph.PowerShell.Module.\u003cSignal\u003ed__35.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.Graph.PowerShell.Cmdlets.GetMgGroup_List1.\u003cMicrosoft-Graph-PowerShell-Runtime-IEventListener-Signal\u003ed__82.MoveNext()\r\n\r\nWRN: Assembly binding logging is turned OFF.\r\nTo enable assembly bind failure logging, set the registry value [HKLM\\Software\\Microsoft\\Fusion!EnableLog] (DWORD) to 1.\r\nNote: There is some performance penalty associated with assembly bind failure logging.\r\nTo turn this feature off, remove the registry value [HKLM\\Software\\Microsoft\\Fusion!EnableLog].\r\n"
                                          ],
                      "Message":  "One or more errors occurred.",
                      "Data":  {

                               },
                      "InnerException":  {
                                             "Message":  "Could not load file or assembly \u0027Microsoft.Graph.Authentication.Core, Version=1.19.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\u0027 or one of its dependencies. The system cannot find the file specified.",
                                             "FileName":  "Microsoft.Graph.Authentication.Core, Version=1.19.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
                                             "FusionLog":  "WRN: Assembly binding logging is turned OFF.\r\nTo enable assembly bind failure logging, set the registry value [HKLM\\Software\\Microsoft\\Fusion!EnableLog] (DWORD) to 1.\r\nNote: There is some performance penalty associated with assembly bind failure logging.\r\nTo turn this feature off, remove the registry value [HKLM\\Software\\Microsoft\\Fusion!EnableLog].\r\n",
                                             "Data":  "System.Collections.ListDictionaryInternal",
                                             "InnerException":  null,
                                             "TargetSite":  "Void MoveNext()",
                                             "StackTrace":  "   at Microsoft.Graph.PowerShell.Module.\u003cOnCmdletBeginProcessing\u003ed__5.MoveNext()\r\n   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine\u0026 stateMachine)\r\n   at Microsoft.Graph.PowerShell.Module.OnCmdletBeginProcessing(String id, CancellationToken cancellationToken, Func`1 getEventData, Func`4 signal, InvocationInfo invocationInfo)\r\n   at 
Microsoft.Graph.PowerShell.Module.\u003cEventHandler\u003ed__4.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n  
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.Graph.PowerShell.Module.\u003cSignal\u003ed__35.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at Microsoft.Graph.PowerShell.Cmdlets.GetMgGroup_List1.\u003cMicrosoft-Graph-PowerShell-Runtime-IEventListener-Signal\u003ed__82.MoveNext()",
                                             "HelpLink":  null,
                                             "Source":  "Microsoft.Graph.Groups.private",
                                             "HResult":  -2147024894
                                         },
                      "TargetSite":  {
                                         "Name":  "ThrowIfExceptional",
                                         "DeclaringType":  "System.Threading.Tasks.Task",
                                         "ReflectedType":  "System.Threading.Tasks.Task",
                                         "MemberType":  8,
                                         "MetadataToken":  100679588,
                                         "Module":  "CommonLanguageRuntimeLibrary",
                                         "IsSecurityCritical":  false,
                                         "IsSecuritySafeCritical":  false,
                                         "IsSecurityTransparent":  true,
                                         "MethodHandle":  "System.RuntimeMethodHandle",
                                         "Attributes":  131,
                                         "CallingConvention":  33,
                                         "ReturnType":  "void",
                                         "ReturnTypeCustomAttributes":  "Void ",
                                         "ReturnParameter":  "Void ",
                                         "IsGenericMethod":  false,
                                         "IsGenericMethodDefinition":  false,
                                         "ContainsGenericParameters":  false,
                                         "MethodImplementationFlags":  0,
                                         "IsPublic":  false,
                                         "IsPrivate":  false,
                                         "IsFamily":  false,
                                         "IsAssembly":  true,
                                         "IsFamilyAndAssembly":  false,
                                         "IsFamilyOrAssembly":  false,
                                         "IsStatic":  false,
                                         "IsFinal":  false,
                                         "IsVirtual":  false,
                                         "IsHideBySig":  true,
                                         "IsAbstract":  false,
                                         "IsSpecialName":  false,
                                         "IsConstructor":  false,
                                         "CustomAttributes":  ""
                                     },
                      "StackTrace":  "   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)\r\n   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)\r\n   at Microsoft.Graph.PowerShell.Cmdlets.GetMgGroup_List1.BeginProcessing()\r\n   at System.Management.Automation.Cmdlet.DoBeginProcessing()\r\n   at System.Management.Automation.CommandProcessorBase.DoBegin()",
                      "HelpLink":  null,
                      "Source":  "mscorlib",
                      "HResult":  -2146233088
                  },
    "TargetObject":  null,
    "CategoryInfo":  {
                         "Category":  0,
                         "Activity":  "Get-MgGroup_List1",
                         "Reason":  "AggregateException",
                         "TargetName":  "",
                         "TargetType":  ""
                     },
    "FullyQualifiedErrorId":  "System.AggregateException,Microsoft.Graph.PowerShell.Cmdlets.GetMgGroup_List1",
    "ErrorDetails":  null,
    "InvocationInfo":  {
                           "MyCommand":  {
                                             "Verb":  "Get",
                                             "Noun":  "MgGroup_List1",
                                             "HelpFile":  "Microsoft.Graph.Groups.private.dll-Help.xml",
                                             "PSSnapIn":  null,
                                             "Version":  "1.19.0.0",
                                             "ImplementingType":  "Microsoft.Graph.PowerShell.Cmdlets.GetMgGroup_List1",
                                             "Definition":  "\r\nGet-MgGroup_List1 [-Break] [-ConsistencyLevel \u003cstring\u003e] [-ExpandProperty \u003cstring[]\u003e] [-Filter \u003cstring\u003e] [-HttpPipelineAppend \u003cSendAsyncStep[]\u003e] [-HttpPipelinePrepend \u003cSendAsyncStep[]\u003e] [-Property \u003cstring[]\u003e] [-Proxy \u003curi\u003e] [-ProxyCredential \u003cpscredential\u003e] [-ProxyUseDefaultCredentials] [-Search \u003cstring\u003e] [-Skip \u003cint\u003e] [-Sort \u003cstring[]\u003e] [-Top \u003cint\u003e] [-PageSize \u003cint\u003e] [-All] [-CountVariable \u003cstring\u003e] [\u003cCommonParameters\u003e]\r\n",
                                             "DefaultParameterSet":  null,
                                             "OutputType":  "Microsoft.Graph.PowerShell.Models.IMicrosoftGraphGroup1",
                                             "Options":  1,
                                             "Name":  "Get-MgGroup_List1",
                                             "CommandType":  8,
                                             "Source":  "Microsoft.Graph.Groups.private",
                                             "Visibility":  0,
                                             "ModuleName":  "Microsoft.Graph.Groups.private",
                                             "Module":  "Microsoft.Graph.Groups.private",
                                             "RemotingCapability":  1,
                                             "Parameters":  "System.Collections.Generic.Dictionary`2[System.String,System.Management.Automation.ParameterMetadata]",
                                             "ParameterSets":  "[-Break] [-ConsistencyLevel \u003cstring\u003e] [-ExpandProperty \u003cstring[]\u003e] [-Filter \u003cstring\u003e] [-HttpPipelineAppend \u003cSendAsyncStep[]\u003e] [-HttpPipelinePrepend \u003cSendAsyncStep[]\u003e] [-Property \u003cstring[]\u003e] [-Proxy \u003curi\u003e] [-ProxyCredential \u003cpscredential\u003e] [-ProxyUseDefaultCredentials] [-Search \u003cstring\u003e] [-Skip \u003cint\u003e] [-Sort \u003cstring[]\u003e] [-Top \u003cint\u003e] [-PageSize \u003cint\u003e] [-All] [-CountVariable \u003cstring\u003e] [\u003cCommonParameters\u003e]"
                                         },
                           "BoundParameters":  {

                                               },
                           "UnboundArguments":  [

                                                ],
                           "ScriptLineNumber":  1,
                           "OffsetInLine":  2,
                           "HistoryId":  9,
                           "ScriptName":  "",
                           "Line":  " Get-MgGroup -Filter \"resourceProvisioningOptions/Any(x:x eq \u0027Team\u0027)\" -All",
                           "PositionMessage":  "At line:1 char:2\r\n+  Get-MgGroup -Filter \"resourceProvisioningOptions/Any(x:x eq \u0027Team\u0027)\" ...\r\n+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~",
                           "PSScriptRoot":  "",
                           "PSCommandPath":  null,
                           "InvocationName":  "Get-MgGroup",
                           "PipelineLength":  0,
                           "PipelinePosition":  0,
                           "ExpectingInput":  false,
                           "CommandOrigin":  1,
                           "DisplayScriptPosition":  null
                       },
    "ScriptStackTrace":  "at Get-MgGroup\u003cBegin\u003e, C:\\Program Files\\WindowsPowerShell\\Modules\\Microsoft.Graph.Groups\\1.19.0\\exports\\v1.0-beta\\ProxyCmdletDefinitions.ps1: line 18257\r\nat \u003cScriptBlock\u003e, \u003cNo file\u003e: line 1",
    "PipelineIterationInfo":  [

                              ],
    "PSMessageDetails":  null
}```

BCall-BT avatar Dec 23 '22 16:12 BCall-BT

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

ghost avatar Dec 27 '22 17:12 ghost

@BCall-BT, how are you installing and importing the modules? The error points to Microsoft.Graph.Groups v1.19.0 not able to load/find Microsoft.Graph.Authentication v1.19.0, which it needs.

Please share the output of the following right after the error?

  • Get-Module Microsoft.Graph* | select Name, Version.

peombwa avatar Dec 27 '22 17:12 peombwa

so I resolved it by not only uninstall/reinstall (that did not work)....

I had to find and uninstall every ms graph related

$G = Get-InstalledModule -Name Microsoft.Graph.*

$G.name | ForEach-Object {
    Remove-Module -Name $_ -ErrorAction SilentlyContinue
    Write-Output "Attempting to uninstall module: $_"
    Uninstall-Module -Name $_ -AllVersions
 }

Then check all module paths $env:PSModulePath and delete and graph related files (found a few).

Then I reinstalled the module with the -Scope AllUsers option

BCall-BT avatar Dec 28 '22 14:12 BCall-BT

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

ghost avatar Jan 01 '23 15:01 ghost

I would like to point out that the Microsoft Graph PowerShell sdk installation process is not a good experience. The5re is some initial feedback that stuff is happening but at some point, there is no feedback and the process just seems to hang for a very long period. In fact, when it does finally finish installing, you just get the cursor back and no notification at all that the installation has completed. So, lots of customers just kill the window because they think the process has hung and when they restart, there is enough functionality to imply that installation was successful.... until they run into an issue like this.

RayGHeld avatar Jan 04 '23 17:01 RayGHeld

Installation of modules is handled by PowerShell's Install-Module. Unfortunately, module authors can't control how PowerShell installs modules to improve on the install experience.

In v2, which is currently in public preview, we've reduced the module's footprint by splitting v1.0 and beta commands into two separate modules. This should significantly improve the installation time. See https://devblogs.microsoft.com/microsoft365dev/microsoft-graph-powershell-v2-is-now-in-public-preview-half-the-size-and-will-speed-up-your-automations/#speed-up-your-automations.

peombwa avatar Jan 04 '23 17:01 peombwa