Remove-MsolGroupMember

Removes a member from a security group.

Syntax

Remove-MsolGroupMember [-GroupMemberObjectId <Guid>] [-GroupMemberType <GroupMemberType>] -GroupObjectId <Guid>
 [-TenantId <Guid>] [<CommonParameters>]

Description

The Remove-MsolGroupMember cmdlet is used to remove a member from a security group. This member can be either a user or a group.

Examples

Example 1: Remove a user from a group

PS C:\> $GroupId = Get-MsolGroup -SearchString "MyGroup"
PS C:\> $UserId = Get-MsolUser -UserPrincipalName "evannarvaez@contoso.com"
PS C:\> Remove-MsoLGroupMember -GroupObjectId $GroupId -GroupMemberType User -GroupmemberObjectId $UserId

This example removes the user evannarvaez@contoso.com from the group named MyGroup.

Parameters

-GroupMemberObjectId

Specifies the unique object ID of the user or group to remove from the group.

Type:Guid
Required:False
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-GroupMemberType

Specifies the type of member to remove from the group. Valid values are: User and Group.

Type:GroupMemberType
Required:False
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-GroupObjectId

Specifies the unique ID of the group from which to remove members.

Type:Guid
Required:True
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-TenantId

Specifies the unique ID of the tenant on which to perform the operation. The default value is the tenant of the current user. This parameter applies only to partner users.

Type:Guid
Required:False
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False