Remove-MsolGroupMember cmdlet ERROR

This topic contains 5 replies, has 3 voices, and was last updated by Profile photo of Jeff Taylor Jeff Taylor 6 months, 1 week ago.

  • Author
    Posts
  • #40497
    Profile photo of Jeff Taylor
    Jeff Taylor
    Participant

    Trying to remove a MSO groupmember for which it seems the cmdlet requires a GroupObjectId parameter however, the get-msolUser doesn't have it available from what I can tell.

     Remove-MsolGroupMember -GroupObjectId ecc923f7-480f-4b61-b0d1-05ddbadf0388 -GroupMemberType User -GroupMemberObjectId
    Remove-MsolGroupMember : Missing an argument for parameter 'GroupMemberObjectId'. Specify a parameter of type 'System.Nullable`1[System.Guid]' and try
    again.

    get-help -example also fail

  • #40503
    Profile photo of Jonathan Warnken
    Jonathan Warnken
    Participant
    • #40736
      Profile photo of Jeff Taylor
      Jeff Taylor
      Participant

      I was looking initially for a -properties * parameter like found in Get-ADUser but this exposed the objectID that I wasn't aware of

      Get-MsolUser -UserPrincipalName foof@company.com | fl objectid 
      ObjectId : 7f916f55-6690-4b1c-965b-ca7886dbc9bs 

      However, I still get an error from this code:

       Remove-MsolGroupMember -GroupObjectId ecc923f7-480f-4b61-b0d1-05ddbadf0384 -GroupMemberType User -GroupMem
      berObjectId 7f916f55-6690-4b1c-965b-ca7886dbc9bs
      Remove-MsolGroupMember : Unable to update parameter. Parameter name: . 
  • #40583
    Profile photo of Dan Potter
    Dan Potter
    Participant

    You are missing an argument for the parameter -GroupMemberObjectId

    -GroupMemberObjectId 123456789

  • #41385
    Profile photo of Dan Potter
    Dan Potter
    Participant

    get-help Remove-MsolGroupMember -Examples

    ————————– EXAMPLE 1 ————————–

    C:\PS>$groupId = Get-MsolGroup -searchString MyGroup
    $userid = get-msoluser -userPrincipalName user@contoso.com
    Remove-MsoLGroupMember -groupObjectId $groupid -GroupMemberType User -groupmemberobjectid $userid

  • #41676
    Profile photo of Jeff Taylor
    Jeff Taylor
    Participant

    Hi Dan, Yes I tried that earlier before posting. I get this error

     Remove-MsolGroupMember : Cannot bind parameter 'GroupObjectId'. Cannot convert the
    "Microsoft.Online.Administration.Group" value of type "Microsoft.Online.Administration.Group" to type
    "System.Guid". 

You must be logged in to reply to this topic.