When you install Windows Server Core in your environment, there is no GUI or desktop experience to manage it. Admins who switch to Server Core from the desktop experience often face a slight learning curve. In this article, I will show you how to join a Server Core machine to an Active Directory (AD) domain with SConfig, PowerShell, or the command prompt.
- Author
- Recent Posts
Surender Kumar has more than twelve years of experience in server and network administration. His fields of interest are Windows Servers, Active Directory, PowerShell, web servers, networking, Linux, virtualization, and penetration testing. He loves writing for his blog.
Contents
- Join the AD domain using SConfig
- Join Sever Core to an Active Directory domain with PowerShell
- Join domain using the command prompt
- Conclusion
Join the AD domain using SConfig ^
Server Configuration, or SConfig, is a built-in utility used to configure and manage a Windows Server Core installation. To join Server Core to an Active Directory domain using the SConfig tool, follow these steps:
Log in to Server Core using a local administrator account.
When you log in to Server Core, the SConfig utility is automatically launched. To launch it on demand, just type SConfig in PowerShell (or a command prompt), and press Enter.
The SConfig utility offers various options to manage Server Core. See the following screenshot for reference:
Viewing the main menu of the SConfig utility
You can see that there is a numeric identifier before each option. To enter a specific setting, just type the numeric value and press Enter. For example, to manage the network settings, type 8 and press Enter.
Before joining the Server Core machine to AD, we will make sure it has the correct hostname and a valid TCP/IP configuration (either static or dynamic).
To configure a hostname, type 2 at the SConfig prompt, and press Enter.
Change the computer name using the SConfig utility
This displays the current computer name. To change it, type the new name, and press Enter.
[Optional] Similarly, use option 8 to configure network settings on your server. Make sure it has a valid TCP/IP and DNS server address configured. You can skip this step if you're using DHCP in your environment.
Configure the IP and DNS addresses using the SConfig utility
After network configuration, ping the IP address of the domain controller to verify network connectivity. To do so, you can either exit out of the SConfig utility or press Ctrl+Shift+Esc to open the Task Manager, select File > Run new task, and then type cmd to launch a new instance of the command prompt. If you get a reply from the domain controller, you're good to go to the next step.
To join the server to a domain, type 1 and press Enter. Now, follow the onscreen instructions to join the domain. See the following screenshot for reference:
Join Server Core to an AD domain using the SConfig utility
If everything goes well, you will see a Successfully joined domain message, and it will ask if you want to change the computer name before restarting. Since we have already changed the name, type n to skip it, and type y to restart the server when prompted.
After restart, log in again. The main menu of SConfig will show that your Server Core is now an AD domain member.
Get the computers domain using the SConfig utility
Join Sever Core to an Active Directory domain with PowerShell ^
If you want to use PowerShell instead of SConfig to join Server Core to an AD domain, follow these steps:
Log in to Server Core using the local administrator account.
If SConfig is automatically launched, type 15, and press Enter to exit out. On Windows Server 2022 Core, the default shell is PowerShell, so exiting out of SConfig will lead you straight into the PowerShell console. If you're on a prior Server Core version, exiting SConfig will take you to the command prompt. In that case, type powershell and press Enter to launch PowerShell.
You can use the [Environment]::MachineName and Get-NetIPConfiguration commands in PowerShell to determine the current computer name and IP address, respectively. See the following screenshot for reference:
Get current computer name and IP configuration using PowerShell
To change the computer name, use the following command:
Rename-Computer -NewName SRV05 -RestartChange computer name using PowerShell
Of course, replace SRV05 with any name you want. This command changes the name of the server and restarts it.
[Optional] To change the TCP/IP configuration, you first need to determine the interface index or alias using the Get-NetIPInterface command for the particular network adapter. You can skip this step if you're using DHCP in your environment.
Get interface index or alias using PowerShell
In my case, the interface index is 6, and the interface alias is Ethernet. Now I will use the New-NetIPAddress command, as shown below, to set a static IP address for the particular adapter:
Set a static IP configuration for a particular adapter using PowerShell
[Optional] To set the DNS server address, use the Set-DNSClientServerAddress command, as shown below:
Set-DNSClientServerAddress –InterfaceIndex 6 -ServerAddresses 192.168.0.50,192.168.0.4Set the DNS client server address for a particular adapter using PowerShell
Make sure you adjust the values according to your environment. You can skip setting up a static IP address and DNS server address if you're using DHCP in your environment.
Now that you have the right computer name and TCP/IP configuration on your server, use the following command to join the Active Directory domain:
Add-Computer -DomainName TestLab.local -Credential TestLab\Surender -Restart -ForceJoin Server Core to the AD domain using PowerShell
Replace the domain name with your own and supply the authorized domain user using the Credential parameter. Type the password for the authorized user when prompted. This command joins the server core to the AD domain and restarts it.
After restart, log in again, and type the following PowerShell command to confirm the domain name of Server Core.
Get-ComputerInfo | select CsDomainGet the computers domain name using PowerShell
Join domain using the command prompt ^
If you're not a fan of either SConfig or PowerShell and still love doing things with a traditional command prompt, follow these steps to add your Server Core to the Active Directory domain:
Log in to Server Core using the local administrator account.
If SConfig is automatically launched, type 15, and press Enter to exit out. If you get into a PowerShell console, just type cmd and press Enter to get a traditional command prompt.
Now use the ipconfig /all command to view the current computer name and IP configurations of the server.
View the current computer name and IP config using a command prompt
To change the computer name, type the following commands:
wmic computersystem where caption="%computername%" rename "SRV05" shutdown -r -t 00Change the computer name using a command prompt
Of course, replace SRV05 with a new name you want to assign to your server and restart it.
[Optional] Before setting up the TCP/IP configuration, you first need to determine the name of the interface, as shown below:
netsh int show interfaceGet interface information using a command prompt
If you see multiple interfaces, just pick the name of the right network adapter. In my case, it is Ethernet. Now that you know the name of the interface you want to configure, use the following command to assign the IP address:
netsh int ipv4 set address name="Ethernet" static 192.168.0.65 255.255.255.0 192.168.0.1 1Set the static IP address and gateway using a command prompt
[Optional] To set the primary and alternate DNS server addresses, use the following commands:
netsh interface ipv4 set dnsserver name="Ethernet" static 192.168.0.50 primary validate=no netsh interface ipv4 add dnsserver "Ethernet" 192.168.0.4 index=2 validate=noSet the primary and alternate DNS server address using a command prompt
You can add more DNS addresses by incrementing the value of index. You can skip setting up a static IP address and DNS server address if you're using DHCP in your environment. After TCP/IP configuration, ping the domain controller to verify network connectivity.
Finally, run the following command to add Server Core to the AD domain:
netdom join %computername% /domain:testlab.local /userd:testlab\surender /passwordd:* shutdown -r -t 00Join Server Core to AD domain using a command prompt
Note that the netdom join command requires a computer name, so we used the %computername% variable to pass the current computer name. Furthermore, the /userd and /password switches are used to pass the credentials of authorized domain users.
Once the server is restarted, use the following command to confirm the domain name:
systeminfo | findstr /b “Domain”Get the computers domain using a command prompt
Get the computer's domain using a command prompt
Subscribe to 4sysops newsletter!
Conclusion ^
You just learned how to add a Windows Server Core computer to the Active Directory domain using SConfig, PowerShell, and the command prompt. What is your favorite method for managing Server Core?