Remove-PnPUser

Removes a specific user from the site collection User Information List

Syntax

Remove-PnPUser
      -Identity <UserPipeBind>
                    [-Force [<SwitchParameter>]]
                    [-Confirm [<SwitchParameter>]]
                    [-Web <WebPipeBind>]
                    [-Connection <SPOnlineConnection>]

Description

This command will allow the removal of a specific user from the User Information List

Examples

------------------EXAMPLE 1------------------

Remove-PnPUser -Identity 23

Remove the user with Id 23 from the User Information List of the current site collection

------------------EXAMPLE 2------------------

Remove-PnPUser -Identity i:0#.f|membership|user@tenant.onmicrosoft.com

Remove the user with LoginName i:0#.f|membership|user@tenant.onmicrosoft.com from the User Information List of the current site collection

------------------EXAMPLE 3------------------

Get-PnPUser | ? Email -eq "user@tenant.onmicrosoft.com" | Remove-PnPUser

Remove the user with e-mail address user@tenant.onmicrosoft.com from the User Information List of the current site collection

------------------EXAMPLE 4------------------

Remove-PnPUser -Identity i:0#.f|membership|user@tenant.onmicrosoft.com -Confirm:$false

Remove the user with LoginName i:0#.f|membership|user@tenant.onmicrosoft.com from the User Information List of the current site collection without asking to confirm the removal first

Required Parameters

-Identity

User ID or login name

Type:UserPipeBind
Position:0
Accept pipeline input:True
Accept wildcard characters:False

Optional Parameters

-Confirm

Specifying the Confirm parameter will allow the confirmation question to be skipped

Type:SwitchParameter
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-Connection

Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.

Type:SPOnlineConnection
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-Force

Specifying the Force parameter will skip the confirmation question

Type:SwitchParameter
Position:Named
Accept pipeline input:False
Accept wildcard characters:False
-Web

This parameter allows you to optionally apply the cmdlet action to a subweb within the current web. In most situations this parameter is not required and you can connect to the subweb using Connect-PnPOnline instead. Specify the GUID, server relative url (i.e. /sites/team1) or web instance of the web to apply the command to. Omit this parameter to use the current web.

Type:WebPipeBind
Position:Named
Accept pipeline input:False
Accept wildcard characters:False

Outputs

Microsoft.SharePoint.Client.User