O'Reilly logo

Windows Server Cookbook by Robbie Allen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

2.8. Setting the Name of a Server

Problem

You want to configure the host name for a server.

Solution

Using a graphical user interface

  1. From the Control Panel, open the System applet.

  2. Select the Computer Name tab (or Network Identification on Windows 2000).

  3. Click the Change button (or Properties on Windows 2000).

  4. Enter the new name in the Computer name field.

  5. If the computer is a member of the domain, you will be prompted for credentials to use for renaming the account in the domain unless you are logged in with a domain administrator account.

  6. Click OK.

  7. Click OK to confirm that you'll need to restart (this won't actually restart the computer).

  8. Click OK again.

  9. Click Yes if you want to restart now or No to restart later.

Using a command-line interface

Use this command to display the current computer name:

> hostname

The compname.exe utility, which is available from http://www.willowhayes.co.uk/, can also display the current computer name:

> compname /s

But this command can also do a whole lot more. This changes a computer's name:

> compname /c <NewServerName>

The truly powerful feature of compname is its ability to name a system based on certain variables (or what it calls templates). You can name a computer based on its serial number, UUID, MAC address, and date, among other things. The following example changes a computer name to contain its serial number at the end:

> compname /c pc-?s

Run compname /? for more information on the available templates.

This is a registry-based method for setting a computer's ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required