Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

 Windows OS Hub / Windows Server 2019 / Basic Commands to Configure and Manage Windows Server Core

June 7, 2023 PowerShellWindows Server 2016Windows Server 2019

Basic Commands to Configure and Manage Windows Server Core

In this article, I tried to describe basic cmd and PowerShell commands used to configure and manage Windows Server Core. I think this guide will be useful both for beginners and experienced system administrators as a reference to basic Server Core administration commands.

Contents:
  • Configure Windows Server Core Using SCONFIG
  • Basic PowerShell Commands to Configure Server Core
  • Useful Windows Server Core Commands

Server Core is a special Windows Server installation mode without most graphical tools and snap-ins. You can manage the Server Core from the command prompt or remotely (using Windows Admin Center or other tools).

Windows Server Core advantages:

  • Lower resource requirements;
  • Improved stability and security; fewer updates are required (due to less amount of code and used components);
  • Ideally suits for use as an infrastructure role server (Active Directory domain controller, DHCP server, Hyper-V host, SMB file server, etc.).

Server Core is licensed as a common physical or virtual Windows Server instance (unlike Hyper-V Server that is totally free).

To install Windows Server 2016/2019 in the Core mode, you must select a typical installation. If you select Windows Server (Desktop Experience), the GUI version of the operating system will be installed (in previous Windows Server versions it was called a Server with a GUI).

installing windows server core 2019 without desktop experience

You cannot switch between Full GUI and Core modes in Windows Server 2016/2019 without server reinstallation.

After Windows Server Core installation, you will be prompted to set a local administrator password.

logonui.exe on server core - set administrator password

When you log on to Server Core, the command prompt appears (cmd.exe). If you want the PowerShell console to be run instead of it, make some changes to the registry. Run the commands below:

Powershell.exe
Set-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\WinLogon' -Name Shell -Value 'PowerShell.exe'

And restart your server:

Restart-Computer -Force

 How to start PowerShell by default on Windows Server Core?

If you have accidentally closed the command prompt window, press Ctrl+Alt+Delete, open the Task Manager -> File -> Run -> and run cmd.exe (or PowerShell.exe).

Configure Windows Server Core Using SCONFIG

You can use the built-in sconfig script for basic Server Core configuration. Just run the sconfig command in your console. You will see a menu with several items:

Configure Server Using Sconfig tool on Windows Server Core 2019

Using the Server Configuration menu, you can do the following:

  • Add a computer to a domain or a workgroup
  • Change a computer name (hostname)
  • Add a local administrator
  • Allow/deny remote management and ICMP response
  • Configure Windows Update settings
  • Install Windows updates
  • Enable/disable RDP
  • Configure network adapter settings (IP address, gateway, DNS server)
  • Set date and time
  • Change telemetry settings
  • Activate your Windows Server instance
  • Log off, restart or shut down your server

Each item in sconfig has its number. To open the item you want, just type its number and press Enter.

Some sconfig menu items have subitems. To get to a setting, you also need to enter its number.

sconfig on server core setting static IP address

We will not describe all sconfig settings, since they are easy to understand. However, in most cases, administrators prefer using various PowerShell scripts to configure new hosts running Server Core. It is easier and faster, especially in mass deployment scenarios.

Basic PowerShell Commands to Configure Server Core

Let’s take a look at the basic PowerShell commands that can be used to configure Server Core.

To get information about your Windows Server build and PowerShell version:

Get-ComputerInfo | select WindowsProductName, WindowsVersion, OsHardwareAbstractionLayer
$PSVersionTable

windows server core get information

To restart Server Core, run this PowerShell command:

Restart-Computer

To log off your Server Core console, use the command below:

logoff

Configure Network Settings on Server Core with PowerShell

Now you need to configure network settings using PowerShell (by default, Windows is configured to receive an IP address from DHCP). Display a list of network adapters:

Get-NetIPConfiguration

Specify an index of your network adapter interface (InterfaceIndex) you want to change and set a new IP address and DNS servers:

New-NetIPaddress -InterfaceIndex 4 -IPAddress 192.168.1.100 -PrefixLength 24 -DefaultGateway 192.168.1.1
Set-DNSClientServerAddress –InterfaceIndex 4 -ServerAddresses 192.168.1.11,192.168.101.11

New-NetIPaddress: windows server core set IP address using PowerShell

Check the current network settings:

Get-NetIPConfiguration

If you want to reset an IP address and return to getting an IP address from DHCP, run the command below:

Set-DnsClientServerAddress –InterfaceIndex 4 –ResetServerAddresses
Set-NetIPInterface –InterfaceIndex 4 -Dhcp Enabled

To enable/disable a network adapter:

Disable-NetAdapter -Name “Ethernet0”
Enable-NetAdapter -Name “Ethernet 0”

To enable, disable, or check the status of IPv6 support for your network adapter:

Disable-NetAdapterBinding -Name "Ethernet0" -ComponentID ms_tcpip6
Enable-NetAdapterBinding -Name "Ethernet0" -ComponentID ms_tcpip6
Get-NetAdapterBinding -ComponentID ms_tcpip6

To configure winhttp proxy server for PowerShell or system connections:

netsh Winhttp set proxy <servername>:<port number>

How to Set Date/Time?

You can set a date, time, or time zone using a graphical tool intl.cpl or PowerShell:

Set-Date -Date "07/21/2021 09:00"
Set-TimeZone "Central Europe Standard Time”

Set Computer Name, Join Domain, and Activate Server Core

To change a computer name (hostname):

Rename-Computer -NewName be-srv01 -PassThru

Rename-Computer powershell

To add a server to your on-premises Active Directory domain:

Add-Computer -DomainName "corp.woshub.com" -Restart

If you want to add additional users to the local administrators group, you can configure a Group Policy or add them manually:

Add-LocalGroupMember -Group "Administrators" -Member "corp\jsmith"

To activate Windows Server, enter your product key:

slmgr.vbs –ipk <productkey>
slmgr.vbs –ato

Or you may activate your host on a KMS server. For example, to activate Windows Server Core 2019 Standart on a KMS host:

slmgr /ipk N69G4-B89J2-4G8F4-WWYCC-J464C
slmgr /skms kms.corp.woshub.com:1688
slmgr /ato

Enabling Remote Administration of Windows Server Core

To allow remote access to Server Core via RDP:

cscript C:\Windows\System32\Scregedit.wsf /ar 0

To allow remote management:

Configure-SMRemoting.exe –Enable
Enable-NetFirewallRule -DisplayGroup “Windows Remote Management”

To display current Remote Management settings:

Configure-SMRemoting.exe -Get

To allow Win-RM for PowerShell Remoting:

Enable-PSRemoting –force

You can manage a server running Windows Server Core remotely from another server (using ServerManager.exe), through a browser using Windows Admin Center (WAC), from any workstation using RSAT, you can also connect to it using RDP, PowerShell Remoting, or SSH (current Windows versions have build-in SSH server).

Configuring Windows Firewall on Server Core

You can find information about how to configure Windows Defender Firewall with PowerShell in this article. I will just show some basic commands here.

To enable Windows Defender Firewall for all profiles:

Set-NetFirewallProfile   -Profile Domain,Public,Private -Enabled True
To change your network type from Public to Private:

Get-NetConnectionProfile | Set-NetConnectionProfile -NetworkCategory Private

To completely disable Windows Firewall (not recommended):

Get-NetFirewallProfile | Set-NetFirewallProfile -enabled false

To allow connection using remote management tools:

Enable-NetFireWallRule -DisplayName “Windows Management Instrumentation (DCOM-In)”
Enable-NetFireWallRule -DisplayGroup “Remote Event Log Management”
Enable-NetFireWallRule -DisplayGroup “Remote Service Management”
Enable-NetFireWallRule -DisplayGroup “Remote Volume Management”
Enable-NetFireWallRule -DisplayGroup “Remote Scheduled Tasks Management”
Enable-NetFireWallRule -DisplayGroup “Windows Firewall Remote Management”
Enable-NetFirewallRule -DisplayGroup "Remote Administration"

How to Install Updates on Windows Server Core?

To manage update options, it is better to use Windows Update Group Policies. However, you can set the update settings manually.

To disable automatic update:
Set-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU -Name AUOptions -Value 1
To automatically download available updates:
Set-ItemProperty -Path HKLM:\Software\Policies\Microsoft\Windows\WindowsUpdate\AU -Name AUOptions -Value 3
To get the list of installed updates:
Get-Hotfix
Or
wmic qfe list
To install Windows updates manually, you can use the wusa tool:
wusa kbnamexxxxx.msu /quiet

To install and manage updates from the command prompt, it is convenient to use the PSWindowsUpdate module for PowerShell.

Managing Windows Core Roles, Services, and Processes

To get a list of all available roles on Windows Server Core, run the following PowerShell command:

Get-WindowsFeature

Get-WindowsFeature on windows server core 2019

To get a list of all installed roles and features in Windows Server (thus you can quickly understand what the server is used for):

Get-WindowsFeature | Where-Object {$_. installstate -eq "installed"} | ft Name,Installstate

For example, to install the DNS role, run this command:

Install-WindowsFeature DNS -IncludeManagementTools

To get a list of all services in Windows:

Get-Service

To see all stopped services:

Get-Service | Where-Object {$_.status -eq   “stopped”}

To restart a service:

Restart-Service -Name spooler

Learn more about managing services with PowerShell.

To manage processes, you can use the Task Manager (taskmgr.exe) or the PowerShell Processes module:

Get-Process cmd, wuaucl* | Select-Object ProcessName, StartTime, MainWindowTitle, Path, Company|ft

Useful Windows Server Core Commands

Finally, I will show some useful PowerShell commands and scripts I often use to manage Server Core.

Information about the status and health of physical disks (the default Storage disk management module is used):

Get-PhysicalDisk | Sort Size | FT FriendlyName, Size, MediaType, SpindleSpeed, HealthStatus, OperationalStatus -AutoSize

Free disk space information:

Get-WmiObject -Class Win32_LogicalDisk |
Select-Object -Property DeviceID, VolumeName, @{Label='FreeSpace (Gb)'; expression={($_.FreeSpace/1GB).ToString('F2')}},
@{Label='Total (Gb)'; expression={($_.Size/1GB).ToString('F2')}},
@{label='FreePercent'; expression={[Math]::Round(($_.freespace / $_.size) * 100, 2)}}|ft

server core get free disk space with powershell

Information about the last 10 reboots of your server:

Get-EventLog system | where-object {$_.eventid -eq 6006} | select -last 10

A list of installed programs:

Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize

To download and extract a ZIP file from an external website:

Invoke-WebRequest https://servername/file.zip -outfile file.zip
Expand-Archive -path '.\file.zip' -DestinationPath C:\Users\Administrator\Documents\

To copy all files from a directory to a remote computer over the network, you can use the Copy-Item cmdlet:

$session = New-PSSession -ComputerName be-dc01
Copy-Item -Path "C:\Logs\*" -ToSession $session -Destination "C:\Logs\" -Recurse -Force

To install the device driver:

Pnputil –i –a c:\install\hpspp\hpdp.inf

Microsoft also offers a special package, Server Core App Compatibility Feature on Demand (FOD), which allows you to install some graphical tools and snap-ins on Windows Core Server 2019 (MMC, Eventvwr, Hyper-V Manager, PerfMon, Resmon, Explorer.exe, Device Manager, Powershell ISE). You can download FOD as an ISO file if your Microsoft subscription is active. You can install it as follows:

Add-WindowsCapability -Online -Name ServerCore.AppCompatibility~~~~0.0.1.0

Server Core App Compatibility Feature on Demand installation will use about 200 MB of additional RAM on your Server Core.

Server Core App Compatibility Feature on Demand (FOD)

In this article, I tried to collect the most useful commands needed to administer Windows Server Core. From time to time, I will update the article and add new commands if they seem necessary for everyday work.

0 comment
5
Facebook Twitter Google + Pinterest
previous post
How to Install and Activate the RDS Licensing Role and CALs on Windows Server 2019/2016?
next post
How To Install and Configure DHCP Server on Windows Server 2019/2016?

Related Reading

How to Connect VPN Before Windows Logon

November 14, 2023

Using WPAD (Web Proxy Auto-Discovery Protocol) on Windows

November 7, 2023

Send Emails with Microsoft Graph API and PowerShell

November 6, 2023

Zabbix: How to Get Data from PowerShell Scripts

October 27, 2023

Tracking Printer Usage with Windows Event Viewer Logs

October 19, 2023

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMWare
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • How to Connect VPN Before Windows Logon

    November 14, 2023
  • Removing Azure Arc Setup Feature on Windows Server 2022

    November 9, 2023
  • Using WPAD (Web Proxy Auto-Discovery Protocol) on Windows

    November 7, 2023
  • Send Emails with Microsoft Graph API and PowerShell

    November 6, 2023
  • Zabbix: How to Get Data from PowerShell Scripts

    October 27, 2023
  • Tracking Printer Usage with Windows Event Viewer Logs

    October 19, 2023
  • PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

    October 15, 2023
  • Reset Root Password in VMware ESXi

    October 12, 2023
  • How to Query and Change Teams User Presence Status with PowerShell

    October 8, 2023
  • How to Increase Size of Disk Partition in Ubuntu

    October 5, 2023

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Configuring Port Forwarding in Windows
  • Manage Windows Updates with PSWindowsUpdate PowerShell Module
  • Start Menu or Taskbar Search Not Working in Windows 10/11
  • Get-ADUser: Find Active Directory User Info with PowerShell
  • Adding Drivers into VMWare ESXi Installation Image
  • Configuring SFTP (SSH FTP) Server on Windows
  • How to Hide Installed Programs in Windows 10 and 11
Footer Logo

@2014 - 2023 - Windows OS Hub. All about operating systems for sysadmins


Back To Top