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.
C:>POWERSHELL
PS C:>Get-ADDomain
Display domain from command prompt.
C:>WMIC COMPUTERSYSTEM LIST BRIEF
Display current logged on user’s domain.
C:>ECHO %USERDOMAIN%
Join a domain named CONTOSO.
C:>POWERSHELL
PS C:>Add-Computer -DomainName CONTOSO -Restart
Join a workgroup named WORKGROUP.
C:>POWERSHELL
PS C:>Add-Computer -WorkGroupName WORKGROUP
Unjoin server from the current domain using the contosoadministrator account.
C:>POWERSHELL
PS C:>Remove-Computer -UnjoinDomaincredential CONTOSOAdministrator -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; http://blogs.technet.com/b/chad/archive/tags/server+core/default.aspx