PowerShell Logo Small

Remove-ADComputer



This is the built-in help made by Microsoft for the command 'Remove-ADComputer', 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 computer.

SYNTAX


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



Search powershellhelp.space

DESCRIPTION


The Remove-ADComputer cmdlet removes an Active Directory computer.


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



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=291083
Add-ADComputerServiceAccount
Get-ADComputer
Get-ADComputerServiceAccount
New-ADComputer
Remove-ADComputerServiceAccount
Set-ADComputer

REMARKS

<

Examples


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

PS C:\>Remove-ADComputer -Identity "FABRIKAM-SRV4"



This command removes one particular computer.




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

PS C:\>Get-ADComputer -Filter 'Location -eq "NA/HQ/Building A"' | Remove-ADComputer


Confirm
Are you sure you want to perform this action? Performing operation "Remove" on Target "CN=LabServer-01,CN=Computers,DC=Fabrikam,DC=com".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): a



This command removes all computers in the location specified by using the Filter parameter.




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

PS C:\>Get-ADComputer -Filter 'Location -eq "NA/HQ/Building A"' | Remove-ADComputer -Confirm:$False



This command removes all computers from the location specified by using the Filter parameter. The command does not prompt you for confirmation.




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

PS C:\>Get-ADComputer -Identity "FABRIKAM-SRV4" | Remove-ADObject -Recursive



This command removes a computer and all leaf objects that are located underneath it in the directory. Note that only a few computer objects create child objects, such as
servers running the Clustering service. This example can be useful for removing those objects and any child objects owned by and associated with them.