Easily Identify Computer Name on Windows 2008 Server Core

 

In Windows Server 2008, one of the installation methods available is server core. A core installation provides a minimal environment for running specific server roles, which reduces the maintenance and management requirements and the attack surface for those server roles. Server core installation does not include the traditional full graphical user interface (GUI). Read more about Server Core on my “Understanding Windows Server 2008 Server Core” article.

If you are planning to deploy Windows Server 2008 – server core installations in your network I would strongly advise you to use the following tip.
 
In all my server core installations I change the default prompt to something like this:
 
This customized command prompt will enable you to quickly and easily identify the name of the server you’re currently logged on to. This is quite useful in scenarios where you’ve got many servers connected to one physical monitor, and you switch between the various displays by using a KVS switch. Another usage for this customized command prompt is when you use RDP or Terminal Services to remotely log on to the server, and since all you get is a command prompt window, it’s hard to tell to which server you’re currently connected.
So, how can you get this cool command prompt? Quite easily, but you do need to edit the server’s registry.

Warning!

This document contains instructions for editing the registry. If you make any error while editing the registry, you can potentially cause Windows to fail or be unable to boot, requiring you to reinstall Windows. Edit the registry at your own risk. Always back up the registry before making any changes. If you do not feel comfortable editing the registry, do not attempt these instructions. Instead, seek the help of a trained computer specialist.

    1. On the server core (or any other Windows Server 2008/Vista/2003 computer) open the registry editor by typing REGEDIT.
    2. In the registry navigate to the following key
​HKLM\System\CurrentControlSet\Control\Session Manager\Environment

 

    1. Look for a key called Prompt, if it’s not there create one using the following settings.

Value Name: Prompt
Data Type: REG_EXPAND_SZ
Value Data: $_Server:%computername%$_Username:%username%$_Date:$D$_Time:$T$_$p$g
 
By using the above values you get the prompt as shown in the above picture.
BTW, here are some of the special codes you can use:
* $A – & (Ampersand) * $B – | (pipe) * $C – ( (Left parenthesis) * $D – Current date * $E – Escape code (ASCII code 27) * $F – ) (Right parenthesis) * $G – > (greater-than sign) * $L – < (less-than sign) * $N – Current drive* $P – Current drive and path * $Q – = (equal sign) * $S – (space) * $T – Current time * $_ – Carriage return and linefeed * $$ – $ (dollar sign)
Cool! Try this tip on Vista. You’ll love it. Since discovering it I never stop using it, even on my private computers…

Related Articles

Recent Windows Server 2008 Forum threads

Got a question? Post it on our Windows Server 2008 forums!