Remove-MsolGroupMember cmdlet ERROR

This topic contains 5 replies, has 3 voices, and was last updated by  Jeff Taylor 2 years ago.

  • Author
  • #40497

    Jeff Taylor

    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

    get-help -example also fail

  • #40503

    Jonathan Warnken
    • #40736

      Jeff Taylor

      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 | 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

    Dan Potter

    You are missing an argument for the parameter -GroupMemberObjectId

    -GroupMemberObjectId 123456789

  • #41385

    Dan Potter

    get-help Remove-MsolGroupMember -Examples

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

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

  • #41676

    Jeff Taylor

    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

You must be logged in to reply to this topic.