Using a simple command, you can add or remove a Windows computer to a Microsoft Windows domain remotely from another computer.
Add a Computer to the Domain
Execute this command from a domain controller:
- Open a command prompt.
- Type
net computer \\computername /add
, then press “Enter“.
Execute this command from a workstation where you have domain admin rights. Change the words in italics to suit your situation:
netdom join computername /domain:domainname
Remove a Computer from the Domain
Execute this command from a domain controller:
- Open a command prompt.
- Type
net computer \\computername /del
, then press “Enter“.
Execute this command from a workstation where you have domain admin rights. Change the words in italics to suit your situation:
netdom removeĀ computername /domain:domainname
These command are especially valuable if you are using batch files.
Paul K says
So everyone knows – all you need is (after installing RSAT Active Directory Domain Services and Lightweight Directory Services Tools of course – is netdom remove computername /force
No need to for a domain name or creds or anything else.
Now – I do this with a LOCAL (non-domain) administrator account. Be sure to make sure you can log in that way so that when you are off the “domain”, you can still log on.
Rajat chauhan says
i am try to join computer with domain via WINDOWS POWERSHELL but i am facing the issues “Cannot establish the WMI connection to the computer ‘RND-D33’ with the following error message: Access is denied. ” please give me tips how i can fix this issue.
oVer says
Holla, i got some problems with a hpelitebook 820 g1 that is domain related.
My account got admin rights, but i am unable to change anything that needs admin rights, due too the need to acess the domain.
I am also unable to make admin changes in cmd.exe while logged in on windows.
I am able to make some admin changes on the login screen with cmd.exe.
Any tips how to leave the domain so that i can acess my full admin rights for the computer, without beeing locked out by the requested to log in to the domain?
febry says
hy mitch, the next problem
if I can’t access Windows Server, can I do it on my local computer?
the problem is I lost access on windows server.
thanx
Roy says
Thanks for the info Mitch. Upon running both commands, does it show up in a log.
Also, I would like to create an icon on my desktop that will remove the pc from a domain just by clicking the icon and I would also like an icon to perform the rejoin option every morning.