Muokkaa

Jaa


Remove-MsolGroupMember

Removes a member from a security group.

Syntax

Remove-MsolGroupMember
      -GroupObjectId <Guid>
      [-GroupMemberType <GroupMemberType>]
      [-GroupMemberObjectId <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
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-GroupMemberType

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

Type:GroupMemberType
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-GroupObjectId

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

Type:Guid
Position:Named
Default value:None
Required:True
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
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False