Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am able to use the native add-computer cmdlet to join a computer to a domain, but it seems that this cmdlet fails if the systems already exists in AD, and you are trying to add it to a different domain.

I would like to delete the existing object with powershell. Is this possible without loading the Active Directory Module? I am doing all this as part of system deployment, and don't want to have to load any additional windows features.

EDIT: This will need run in a way where I can pass credentials to the command. It will be run in the context of a local user.

share|improve this question
netdom will let you pass creds. – tony roth Nov 9 '12 at 15:24
How are you imaging these computers? If you're using an unattend file, there's a specific field for domain join that is run during the Specialize pass. – MDMarra Nov 9 '12 at 15:30
up vote 2 down vote accepted

I would suggest using DSRM CLI-tool, which is awesome.

DSRM description and usage examples - Technet

NOTE: it's not available on W7, but *.exe files can be extracted from Windows Server 2008 machine.

How can i get DSRM.exe to work without installing RSAT

share|improve this answer
dsrm would mean that you have the active dir tools loaded. – tony roth Nov 9 '12 at 15:05
Yes, right you are. Edited answer with an update. – Volodymyr M. Nov 9 '12 at 15:06
don't think I'd waste my time with dsrm in this case since netdom is builtin. – tony roth Nov 9 '12 at 15:14
Are you sure netdom is built-in on W7 OS? Tried viewing help for just now on my machine, but got not recognized message. It's built in on Windows Server family OS – Volodymyr M. Nov 9 '12 at 15:19
lol you maybe right, in my case it must be there due to the imaging process that we use. – tony roth Nov 9 '12 at 15:22

use net computer \\computername /del or use netdom remove which will allow you to specify what domain.

Looks like netdom.exe is not native to Windows 7 so just add it to your image.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.