Remove-MsolUser
Removes a user from Azure Active Directory.
Syntax
Copy
PowerShell
Remove-MsolUser [-Force] -ObjectId <Guid> [-RemoveFromRecycleBin] [-TenantId <Guid>] [<CommonParameters>]
Copy
PowerShell
Remove-MsolUser [-Force] [-RemoveFromRecycleBin] [-TenantId <Guid>] -UserPrincipalName <String>
[<CommonParameters>]
Description
The Remove-MsolUser cmdlet is used to remove a user from Azure Active Directory. This cmdlet deletes the user, their licenses, and any other associated data.
Examples
Example 1: Remove a user
Copy
PowerShell
Remove-MsolUser -UserPrincipalName "davidchew@contoso.com"
This command removes the user davidchew@contoso.com from Azure Active Directory. If the user has any licenses, the cmdlet removes these. The command prompts you to confirm the operation.
Example 2: Remove a user without confirmation
Copy
PowerShell
Remove-MsolUser -UserPrincipalName "davidchew@contoso.com" -Force
This command removes davidchew@contoso.com from Azure Active Directory. If the user has any licenses, the cmdlet removes these.
Example 3: Remove a user from the Recycle Bin
Copy
PowerShell
Remove-MsolUser -UserPrincipalName "davidchew@contoso.com" -RemoveFromRecycleBin
This command removes davidchew@contoso.com from the Azure Active Directory recycle bin. The command prompts you to confirm the operation. This command permanently removes the user.
Parameters
-Force
Indicates that this cmdlet does not prompt you for confirmation.
Type: | SwitchParameter |
Required: | False |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-ObjectId
Specifies the unique object ID of the user to remove.
Type: | Guid |
Required: | True |
Position: | Named |
Default value: | None |
Accept pipeline input: | True (ByPropertyName) |
Accept wildcard characters: | False |
-RemoveFromRecycleBin
Indicates that this cmdlet permanently removes a deleted user from the recycle bin. This operation which can be applied only to deleted users. When this operation has been completed, you will not be able to recover the user by using the
cmdlet.Type: | SwitchParameter |
Required: | False |
Position: | Named |
Default value: | None |
Accept pipeline input: | True (ByPropertyName) |
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 |
-UserPrincipalName
Specifies the user principal name of the user to remove.
Type: | String |
Required: | True |
Position: | Named |
Default value: | None |
Accept pipeline input: | True (ByPropertyName) |
Accept wildcard characters: | False |
Commenti
Posta un commento