Windows: Join a workgroup or domain from command line


there are two ways to join or leave a domain. The netdom command or the Powershell Command lets add-computer and remove-computer.

The netdom way

Join a domain. If you are logged on at the machine you want to join

C:\> netdom join %computername% / /UserD:LoginWithJoinPermissions /PasswordD:*

Remove from Domain and join a workgroup. The /force option disjoins the computer from the domain even if you to not have the permission to remove the computer object from the domain. The domain computer object remains.

c:\> netdom remove %computername% / /force

The Powershell way

Join a Domain

PS C:\> Add-computer -DomainName "" -Credential LoginWithJoinPermissions 

Remove from Domain and join a workgroup.

PS C:\> Remove-computer -WorkgroupName yourWorkgroup 


Advertisment to support

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.