Geek of All TradesMaking Sense of Server Core

Greg Shields

Contents

Windows Server 2008, MS-DOS Edition
The Cheat Sheet
Core Management

In the world of IT publications, the needs of the jack-of-all-trades IT professional are perhaps the least represented. With all the books and articles that explain today's technology in deep and gory detail, too often the needs of the smaller-environment IT pro don't get met. Does this describe you? Are you ultimately responsible for every facet of your computing environment? Is it your job to manage everything from network routing to server administration to changing toner cartridges in the printers?

If so, this column is dedicated to you. My name is Greg Shields and I've spent the last 15 years working in IT environments both large and small, and have devoted the last few to writing about what I've seen and learned. I'm excited about this monthly opportunity to share the best real-world tips and tricks that you—the master of none—can implement today to improve your small IT environment.

You'll note that I'm specifically not saying "your small business" here. While those of us in small businesses today typify the jack-of-all-trades IT professional, there are others whose job it is to manage small parts of a much bigger organization. No matter, if you're in charge of it all, you've likely got a "just-get-it-done" outlook on work. In this column, I'll attempt to tell you exactly how to do that, and hopefully get you home on time every night as an added bonus.

To start you out right, this first column will talk about a new form of Windows Server you might not have paid attention to yet. Server Core in Windows Server 2008 is a compelling new addition that makes sense for the small computing environment. In this column, I'll tell you why that might be the case and where it might fit best. I'll also take you through the steps you'll need to set up your first instance of Server Core on Windows Server 2008.

Windows Server 2008, MS-DOS Edition

The MSDN Web site refers to Server Core as "a minimal server installation option for computers running on the Windows Server 2008 operating system. Server Core provides a low-maintenance server environment with limited functionality." Lots of words, but what they really say is that Server Core arrives as another installation option for Windows Server 2008, one that strips away vast amounts of functionality from the operating system. There is no Explorer shell. There is no Internet Explorer. There is no support for managed code.

Server Core is one result of some componentization activities that were completed by Microsoft in the development of Windows Server 2008. From a high-level perspective, this componentization looked at the codebase that was Windows Server and broke it down into logical groups that connect to each other. The detailed knowledge thus gained of the components that make up Windows Server, along with the interfaces between those components, better enabled Microsoft to make decisions about which components could be safely set side.

By stripping Windows down to its bare essentials, even eliminating nearly all its graphical user interfaces, the end result is a smaller OS with a reduced attack surface and fewer requirements for hardware resources. Those reduced hardware requirements mean Server Core can be installed on less-powerful servers. With Server Core, you can continue using older hardware that you might otherwise dispose of.

As noted earlier, this slimmer and trimmer OS eliminates virtually every graphical tool used to administer a server at its console. For all practical purposes, Server Core can be (jokingly) considered Windows Server 2008, MS-DOS Edition. So if you're to use it in your environment, you'll need to dust off your old command-prompt skills and relearn the text commands you may not have used in years.

For some, that's the bad news. But once you've gotten through that initial re-learning process, you'll find you've developed some command-line techniques you can immediately use in managing the other "real" Windows servers in your environment. This is the case because, with few exceptions, every command you use to manage your Server Core instance can be used on the full Windows Server to accomplish the same task. More command-line management results in more scripts and batch files, which lets you solve problems and administer your environment both faster and with more reliability.

If Server Core's command-line requirements still scare you, you will be happy to know that most of the command-line configuration happens when you first build your server. Once the server is built, networked, and connected to your domain, you'll use your regular administrative consoles like those you use for your other servers.

The Cheat Sheet

Toward that end, let me help you through your first Server Core installation. This process includes all the commands that you'll need to run from the command prompt after the initial installation in order to get your server ready for operation.

Server Core arrives not as a separate edition of Windows Server 2008, but instead as an installation option. This means that no matter what edition of Windows Server you purchase—Standard, Enterprise, or Datacenter—you have the option of installing that instance as either a full version or a Server Core version. You'll see these options when you drop the installation DVD into a candidate server's drive and boot the machine.

After answering some initial questions about the installation, you'll see a screen similar to Figure 1, where you can select the installation option for the edition you've chosen. In this case, we'll install the Standard Edition of Windows Server 2008 with the Server Core Installation option. Finish answering WinPE's preinstallation questions to kick off the installation.

fig01.gif

Figure 1 Server Core is an installation option

Once the installation routine completes, log in as administrator with a blank password. You'll immediately be asked to change that password. When that's done, you'll be logged in and presented with Server Core's undeniably minimalist user interface. Figure 2 shows the sparse style of the console of your Server Core instance.

fig02.gif

Figure 2 Server Core’s interface shows little more than a command prompt

A freshly installed Server Core instance arrives with none of the needed settings preconfigured. To get that instance on the network, in your domain, and ready for work involves a set of configurations that you'll accomplish through the command prompt. Though this may sound daunting, feel free to use what follows as a cheat sheet to get you through the initial configuration:

Change the Computer's Name Your computer may have some random name. Change that name with the following command:

netdom renamecomputer %computername%
  /newname:{newComputerName} 

After that, you need to reboot the computer, which you can do with the following command:

shutdown /r /f /t 0

Set Static IP Address, Subnet Mask, and Default Gateway If you use DHCP for your servers, ignore this step. To set a static IP address and configure the default gateway for your server, use this command:

netsh interface ipv4 set address {interfaceName} static
  {ipAddress} {subnetMask} {defaultGateway}

For most servers the value for {interfaceName} will be set to "Local Area Connection." You can verify that name first with this command:

netsh interface show interface

Set a DNS Server Finish up your network configuration by setting your server's DNS server address. Do it with this command:

netsh interface ipv4 add dnsserver name={interfaceName}
  address={dnsServerIpAddress} index=1

Join the Domain Once the computer's name and networking are set, join it to the domain with this command:

netdom join {computerName} /domain:{domainName}
  /userD:{domainUsername} /passwordD:{domainPassword}

Note that you'll need to reboot the computer again after you've completed this process.

Configure a Proxy Server If your organization makes use of a proxy server to connect to the Internet, set its configuration with this command:

netsh winhttp set proxy {proxyServerName}:{proxyPortNumber}

Although Server Core doesn't have the ability to run a Web browser, environments that use proxies will need to configure this setting if they will be using Automatic Updates to download updates from the Internet.

Add and Activate a License Key Server Core doesn't include Server Manager, so the command line is the mechanism for licensing your server. Enter its license key with this command:

slmgr –ipk {licenseKey}

You can separate the character strings in that key with dashes. Activate that license with this command:

slmgr –ato

Be patient during the long pause you are likely to experience after entering these commands, before you see a pop-up window with their result.

Configure Automatic Updates Automatic Updates can be configured via the command line or through Group Policy. Note that it is usually easier to use Group Policy to configure your Server Core instance along with the rest of your environment. However, if your Group Policy configuration for Automatic Updates is set to notify before downloading or installing, it will not work with Server Core.

With no explorer shell, the balloon notifications used by Automatic Updates do not function with Server Core. However, you can use the screg­edit.wsf script found in C:\Windows\System32 to set Automatic Updates to download updates and install them at 3:00 A.M. every day, like so:

Cscript c:\windows\system32\scregedit.wsf /au 4

Manage the Windows Firewall with Advanced Security As with Automatic Updates, the Windows Firewall with Advanced Security is best managed with Group Policy. However, if you wish to turn the firewall on or off on a standalone instance, you can do so with this command:

netsh advfirewall set {profileName} state {on|off}

Use the command

netsh advfirewall set /?

to determine the values for {profileName}.

Enable Remote Desktop Finally, if you ever want to manage your Server Core instance's console via Terminal Services, you would use this command:

cscript c:\windows\system32\scregedit.wsf /ar 0

That's it. Now you're ready to install whatever components you need onto your Server Core instance. Remember that Server Core is limited to only a subset of the possible roles that can be installed to a full Windows Server 2008 instance:

  • Active Directory Domain Services
  • Active Directory Lightweight Domain Services
  • DHCP Server
  • DNS Server
  • File Services
  • Media Services
  • Print Services
  • Hyper-V
  • Web Services (IIS) (Limited)

The limited roles available mean that your Server Core instance will likely fulfill only a few needs in your environment. Server Core instances make great lightweight infrastructure servers like domain controllers, DNS servers, or file servers, for example. Because you need only limited direct, on-console interaction with these types of roles, you can generally get by with lesser and/or older hardware.

Server Core's reduced hardware also needs help when hosting Hyper-V. With Hyper-V, your goal is to squeeze as much performance out of your hardware as possible for the running of virtual machines. Since a primary partition operating system instance is required for the processing of Hyper-V's virtualization layer, Server Core's more limited hardware needs means more hardware resources will be available for the operation of your virtual machines.

To take advantage of this, there are two commands you'll need to know to install components into Server Core. The first, oclist, lists the available and installed components on the server. The second, ocsetup {componentName} installs a desired component. For example, to install the Hyper-V role, use this command:

ocsetup Microsoft-Hyper-V

Be aware that unlike virtually every Windows command, ocsetup is case-sensitive. Thus, to install a component, you'll need to use oclist to get the exact name with proper case to later install it with ocsetup.

Another command, Wusa, is handy for the installation of patches. To manually install MSU or MSP patches, use this command:

wusa {patchFileName}

Core Management

Once Server Core is installed, the remainder of your administration is likely to be done through the management consoles already installed to your desktop. For example, once the Hyper-V role is installed, all other work with Hyper-V is then done through the Hyper-V Manager. This makes working with Server Core instances easy once they're built.

On occasion, you'll still need to interact with the server itself to work with files or install a new component or patch. The most obvious and easiest way to accomplish this is by connecting to the server using Terminal Services. But there is another set of command-line tools, the Microsoft PsTools, that can help.

The PsTools have long been used by smart administrators to accomplish command line-based actions remotely on systems all around the network. The tools are of particular use with Server Core since its installation is all about the command line.

If you haven't yet downloaded these tools, you can get them from the PsTools site at technet.microsoft.com/sysinternals/bb896649.aspx. The download includes an HTML help file with usage information for all of the tools.

Then copy them after unpacking to a location in the path of your management desktop. Helpful hint: I copy them to c:\windows where they'll always be available when I open a command prompt.

There are many PsTools, but two in particular are useful for working with Server Core. The first, PsExec, provides a way for you to run a command on another computer remotely. This is useful for initiating individual commands on remote Server Core instances, but even more compelling when you use it to launch a remote command prompt. As shown in Figure 3, you can do this from your management desktop with this command:

psexec \\{computerName} cmd

fig03.gif

Figure 3 PsExec brings Server Core’s command prompt to your local desktop

If you run this command against your Server Core instance, you'll see that your command prompt happens to be the very same command prompt on the remote server.

Sometimes you merely want to discover how processes are behaving on your server. Maybe a process is using more than its fair share of the processor or memory. PsList can help. To launch a regularly updating text-based view of processes and view their resource use (as shown in Figure 4), use this command:

pslist \\{computerName} /s

fig04.gif

Figure 4 PsList lets you display a list of running processes

The resulting list of processes repeatedly updates and is ordered by processor use. If you happen to find some processes that are misbehaving, you can kill any offending processes with this command:

pskill \\{computerName} {processNameOrPid}

Finally, you will also find the two scripting languages VBScript and Windows PowerShell very useful for managing your Server Core instance. While Server Core comes equipped with the necessary VBScript runtime code to launch commands directly from its console, it does not presently include the ability to use Windows PowerShell. So, while you can run Windows PowerShell commands on your management desktop against a Server Core instance, you can't directly launch them within your Server Core instance.

So, there you have it. I've provided you with enough information to get started using Server Core in your small environment today.

Got a problem in your small environment or something you'd like a little help or insight into? Send your questions and suggestions to me at gshields@concentratedtech.com.

Greg Shields, MVP, is a co-founder and IT guru with Concentrated Technology. His latest book, Windows Server 2008: What's New/What's Changed, is available through SAPIEN Press. Get to know him at ConcentratedTech.com.