Running Windows Core: How-to view domain and join/unjoin domain

Running Windows Core Series, getting on and off the domain.

When running these commands or using them in scripts keep in mind that some may become deprecated in future versions of Windows. Best practice is to use the PowerShell commands when possible to future proof any script that use these commands. These commands were run on Windows Server 2012R2.

When running Windows Server 2012+ without a GUI note that the GUI can be reinstalled via PowerShell (Install-WindowsFeature) and a reboot.


From Windows Server core command prompt:

Display current domain information using AD management tools.


PS C:\>Get-ADDomain


Display domain from command prompt.



Display current logged on user's domain.



Join a domain named CONTOSO.


PS C:\>Add-Computer -DomainName CONTOSO -Restart


Join a workgroup named WORKGROUP.


PS C:\>Add-Computer -WorkGroupName WORKGROUP


Unjoin server from the current domain using the contoso\administrator account.


PS C:\>Remove-Computer -UnjoinDomaincredential CONTOSO\Administrator -Passthru -Verbose -Restart


If you know any other interesting ways of getting this information from a Windows Server core installation post below.

Thanks for stopping by and see other Windows Server core tips;

Comments (2)

  1. Forgot about Netdom to add a machine to the domain.

    Netdom.exe add {/d: | /domain:} [{/ud: | /userd:}[ ] {/pd: | /passwordd:}{ |*}] [{/s: | /server:} ] [/ou: ] [/dc] [/help | /?]

  2. Anonymous says:

      Recent Releases and Announcements   ·        Microsoft Disaster

Skip to main content