Forum Discussion

Dean_Gross's avatar
Dean_Gross
Silver Contributor
Feb 21, 2017

Unable to get groups with POSH

I am getting the following error. Can someone please tell me what I'm doing wrong? I'm a Global admin in the tenant.

 

Connect-PnPMicrosoftGraph -Scopes "Group.ReadWrite.All","User.Read.All"

PS C:\Scripts> Get-PnPUnifiedGroup
Get-PnPUnifiedGroup : Exception of type 'Microsoft.Graph.ServiceException' was thrown.
At line:1 char:1
+ Get-PnPUnifiedGroup
+ ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-PnPUnifiedGroup], ServiceException
    + FullyQualifiedErrorId : Microsoft.Graph.ServiceException,SharePointPnP.PowerShell.Commands.Graph.GetUnifiedGroup

13 Replies

  • Hi Dean,

     

    I just tried here but I get no errors. If you execute the cmdlet as said, and if you still receive the error, can you enter 

     

    $error[0].Exception.StackTrace

     

    and post that?

    • Dean_Gross's avatar
      Dean_Gross
      Silver Contributor

      Erwin van Hunen thanks for the suggestion. This is what I get. I don't understand what this means, does it provide you any clues?

       

      PS C:\> $error[0].Exception.StackTrace
         at Microsoft.Graph.HttpProvider.<SendAsync>d__19.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
         at Microsoft.Graph.BaseRequest.<SendRequestAsync>d__34.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
         at Microsoft.Graph.BaseRequest.<SendAsync>d__32`1.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
         at Microsoft.Graph.DriveRequest.<GetAsync>d__6.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
         at OfficeDevPnP.Core.Framework.Graph.UnifiedGroupsUtility.<>c__DisplayClass3_0.<<GetUnifiedGroupSiteUrl>b__0>d.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
         at OfficeDevPnP.Core.Framework.Graph.UnifiedGroupsUtility.GetUnifiedGroupSiteUrl(String groupId, String accessToken, Int32 retryCount, Int32 delay)
         at OfficeDevPnP.Core.Framework.Graph.UnifiedGroupsUtility.<>c__DisplayClass10_0.<<ListUnifiedGroups>b__0>d.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
         at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
         at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
         at OfficeDevPnP.Core.Framework.Graph.UnifiedGroupsUtility.ListUnifiedGroups(String accessToken, String displayName, String mailNickname, Int32 startIndex, Int32 endIndex, Boole
      an includeSite, Int32 retryCount, Int32 delay)
         at SharePointPnP.PowerShell.Commands.Graph.GetUnifiedGroup.ExecuteCmdlet()
         at System.Management.Automation.CommandProcessor.ProcessRecord()

      • Marc Vanderstraeten's avatar
        Marc Vanderstraeten
        Copper Contributor

        Dear all,

         

        I have the same issue and desperately looking for a solution...

         

        I still can use the MS cmdlet

        Help please?

      • Brent Ellis's avatar
        Brent Ellis
        Silver Contributor
        For what it is worth, I literally just installed PNP PowerShell yesterday to start playing with it, copied and pasted your code and it ran just fine. So the syntax is at least right.

Resources