PowerShell Logo Small

Remove-ADUser



This is the built-in help made by Microsoft for the command 'Remove-ADUser', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Removes an Active Directory user.

SYNTAX


Remove-ADUser [-Identity] <ADUser> [-AuthType {Negotiate | Basic}] [-Credential <PSCredential>] [-Partition <String>] [-Server <String>] [-Confirm] [-WhatIf]
[<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Remove-ADUser cmdlet removes an Active Directory user.


The Identity parameter specifies the Active Directory user to remove. You can identify a user by its distinguished name (DN), GUID, security identifier (SID) or security
accounts manager (SAM) account name. You can also set the Identity parameter to a user object variable, such as $<localUserObject>, or you can pass a user object through the
pipeline to the Identity parameter. For example, you can use the Get-ADUser cmdlet to retrieve a user object and then pass the object through the pipeline to the
Remove-ADUser cmdlet.


If the ADUser is being identified by its DN, the Partition parameter will be automatically determined.


For AD LDS environments, the Partition parameter must be specified except in the following two conditions:

-- The cmdlet is run from an Active Directory provider drive.
-- A default naming context or partition is defined for the AD LDS environment. To specify a default naming context for an AD LDS environment, set the
msDS-defaultNamingContext property of the Active Directory directory service agent (DSA) object (nTDSDSA) for the AD LDS instance.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=291101
Get-ADUser
New-ADUser
Set-ADUser

REMARKS

<

Examples


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

PS C:\>Remove-ADUser -Identity GlenJohn



This command removes the user with samAccountName GlenJohn.




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

PS C:\>Search-ADAccount -AccountDisabled | where {$_.ObjectClass -eq 'user'} | Remove-ADUser



This command searches for any users that have disabled accounts and remove them.




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

PS C:\>Remove-ADUser -Identity "CN=Glen John,OU=Finance,OU=UserAccounts,DC=FABRIKAM,DC=COM"



This command removes the user with DistinguishedName CN=Glen John,OU=Finance,OU=UserAccounts,DC=FABRIKAM,DC=COM.




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

PS C:\>Get-ADUser -Identity "cn=glenjohn,dc=appnc" -Server Lds.Fabrikam.com:50000 | Remove-ADUser



This command gets the user with DistinguishedName cn=glenjohn,dc=appnc from the AD LDS instance and removes it.