Windows: Join A Workgroup Or Domain From Command Line

Skip to content

Hi,

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% /domain:your.ADDomainToJoin.net /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% /domain:your.OldADDomain.net /force

The Powershell way

Join a Domain

PS C:\> Add-computer -DomainName "your.ADDomainToJoin.net" -Credential LoginWithJoinPermissions

Remove from Domain and join a workgroup.

PS C:\> Remove-computer -WorkgroupName yourWorkgroup

Michael

Post navigation Previous PostWindows: Decode Win32 Error codesNext PostWindows: Reset WSUS and recreate SUSDB

Leave a Reply Cancel reply

You must be logged in to post a comment.

My Knowledgebase for things about Linux, Windows, VMware, Electronic and so on…

CategoriesCategories Select Category Apache KnowHow Devices Brocade Fabric OS Hantek 6022 Ornage PI PC Shelly Sonoff Tasmota Electronic EIB/KNX IoT Links Orange Pi Raspberry PI Forensic Fritzbox Germany specific Topics Homeautomation Sonoff Tasmota Java Linux Debian Samba Microcontroller ESP32 ESP8266 miscellaneous Kodi LibreElec Openelec Tools Unbound MySQL SQL Snipets Network OpenVPN Scripting & programming C# git PHP Powershell Python Regulare Expressions Selenium SQLite Visual Studio XML Security openssl Services Active Directory Asterisk Docker icecast IIS MariaDB MQTT ntp OpenHAB rsync Youtube Tools cURL Ghostscript tcpdump Uncategorized Virtualisation VirtualBox VMware Windows Hyper-V Office 365 Windows knowhow Windows Scripts Windows subsystem for linux WSL Wordpress Recent Comments
  • melik2k3 on Windows: Removing Appx failed with 0x80070032: This app is part of Windows and cannot be uninstalled on a per-user basis.
  • PW on Windows: Passing parameters to event triggered schedule tasks
  • Abbasali Dadkhah on Windows: Passing parameters to event triggered schedule tasks
Donate

Consider to make a small donation if the information on this site are useful :-)

RSS Follow michlstechblog
  • Windows: Remote Desktop Client returns “internal error”
  • Unbound: Build (Cross compile on Fedora) it for Windows
  • Smartmeter: vzlogger on Orange Pi Zero with homeassistant integration
  • Tasmota: Build firmware for Smart Meter Interfaces
  • Windows: sysprep fails with “Failure occurred while executing ‘Sysprep_Clean_Opk’ “
Links This website uses cookies to improve your experience and to serv personalized advertising by google adsense. By using this website, you consent to the use of cookies for personalized content and advertising. For more information about cookies, please see our Privacy Policy, but you can opt-out if you wish. Accept Reject Read MorePrivacy & Cookies Policy Close

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience. Necessary Necessary Always Enabled Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information. Non-necessary Non-necessary Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website. SAVE & ACCEPT Go to mobile version

Tag » Add Computer To Active Directory Command Line