Remove-ADComputer

Remove an AD computer.

Syntax
      Remove-ADComputer [-Identity] ADComputer [-AuthType {Negotiate | Basic}]
         [-Credential PSCredential] [-Partition string] [-Server string]
            [-Confirm] [-WhatIf] [CommonParameters]

Key       
   -AuthType ADAuthType
       The authentication method to use:
          Negotiate or 0
          Basic or 1
       A Secure Sockets Layer (SSL) connection is required for the Basic authentication method.

   -Credential PSCredential
	    A user account that has permission to perform this action.
       The default is the current user unless the cmdlet is run from an AD PowerShell provider drive
       in which case the account associated with the drive is the default.

       "User64" or "Domain01\User64" or a PSCredential object.

   -Identity ADComputer
       An AD computer object:

          Distinguished Name
             Example: CN=PC1234,CN=Europe,CN=Users,DC=SS64,DC=com
          GUID  (objectGUID)
             Example: 579c4d2e-f62d-4d20-8a88-030d97495f10
          Security Identifier (objectSid)
             Example: S-1-5-21-3164297828-301567370-526410523-1153
          Security Accounts Manager Account Name (sAMAccountName)
             Example: PC1234

       The identifier in parentheses is the LDAP display name for the attribute.

       The cmdlet searches the default naming context or partition to find the object.
       If the identifier given is a DN, the partition to search will be computed from that DN.
       If two or more objects are found, the cmdlet returns a non-terminating error.

       This parameter can also accept an object through the pipeline.

    -Partition string
       The distinguished name of an AD partition.
       The distinguished name must be one of the naming contexts on the current directory server.
       The cmdlet searches this partition to find the object defined by the -Identity parameter.
       examples:
          -Partition "CN=Configuration,DC=EUROPE,DC=TEST,DC=SS64,DC=com"
          -Partition "CN=Schema,CN=Configuration,DC=EUROPE,DC=TEST,DC=SS64,DC=com"

       In many cases, a default value will be used for -Partition if no value is specified.
        
   -Server string
       The AD Domain Services instance to connect to, this may be a Fully qualified domain name,
       NetBIOS name, Fully qualified directory server name (with or without port number)  or AD Snapshot instance.
 
       Examples: demo.SS64.com  demo  demoDC02.demo.ss64.com  demoDC02.demo.ss64.com:3268
       
   -Confirm
       Prompt for confirmation before executing the command.
        
    -WhatIf
       Describe what would happen if you executed the command, without actually executing the command.

   CommonParameters:
       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
       -OutBuffer -OutVariable.

Remove-ADComputer removes an AD computer.

The -Identity parameter specifies the AD computer to remove. Identify a computer by its distinguished name Members (DN), GUID, security identifier (SID), or Security Accounts Manager (SAM) account name. The -Identity parameter can be set to a computer object variable, or a computer object passed through the pipeline. for example, from Get-ADComputer.

Examples

Remove one particular computer:

PS C:\> Remove-ADComputer -Identity "SRV251"

Remove all computers in a given location (will prompt: 'Are you sure', to disable the confirmation prompt use Remove-ADComputer -confirm:$false):

PS C:\> Get-ADComputer -Filter 'Location -eq "Stavanger, Norway"' | Remove-ADComputer

“The Skynet Funding Bill is passed. The system goes on-line August 4th, 1997. Human decisions are removed from strategic defense. Skynet begins to learn at a geometric rate. It becomes self-aware at 2:14 a.m. Eastern time, August 29th. In a panic, they try to pull the plug” ~ The Terminator

Related:

Get-ADComputer - Get one or more AD computers.
New-ADComputer
- Create a new AD computer.
Set-ADComputer - Modify an AD computer


© Copyright SS64.com 1999-2013
Some rights reserved