Advertisements

Windows 2008 Server core command

A change for the usual VMware ESX type post today,  I have recently been working with Server core for the first time,  and have found out that I actually like it :S.  That said for those of you that have been weaned on a GUI it is a bit of a culture shock.

So below are some commands that I hope you will find useful in configuring your ServerCore windows 2008 machine.

Firstly a couple of whatcha’s and gotcha’s: As already mentioned a Win2K8 ServerCore can be a bit tricky if you are not used to using the command line. There are a couple of things to remember before installing Windows Server Core onto a computer:

  • You must do a clean install, there is not upgrade path from an earlier version nor can you convert a current Win2K8 server to ServerCore.
  • likewise there is not upgrade path form ServerCore to the full version of Windows Server 2008. Again if you need the GUI interface, an Internet browser, or a server role that is not included with ServerCore, then you must reinstall to perform a clean install of a traditional version of Win2K8.

Firstly to install ServerCore you will need to select it during installation,however if you are only installing a single machine with server core it is easy as it is there on the version selection screen of the GUI installation.  creating a number of machine via scripted installation is beyond the scope of this post.

Post Install Tasks

Once setup completes, the first task it to set the Administrator password. Press CTRL + ALT + DEL, click Other User and type in Administrator for the user name. Leave the password blank and press Enter. You’ll be prompted to enter a new password for the Administrator account.

However, if you need to change that password at a later date, you will need to manually set the local Administrator password using the command line. Here is the command:

net user administrator *

Just like the full version of win2K8, you need to activate the Server Core install.

Note:- If you close the command prompt in Server Core, you will not be able to manage the server, fortunately you can recover the command prompt by pressing CTRL + ALT + DEL and clicking on Task Manager. Then click File, Run and type in cmd.exe. This brings back the command prompt in Server Core.

OK back to activation. To activate Windows Server Core, type in the following command in the command prompt:

slmgr ““ ato

If activation is successful you will receive a nice little Message box telling you that it has worked. One bug bare of mine is that you can no longer chose your computer name during installation, the installation routine chooses a random name and particularly obtuse name at that, So you need to change the name of the computer in Server Core use the following command:

netdom renamecomputer %computername% /NewName:newname

You will notice that the command uses %computername%  this is a variable,  what it does in this case is substitute %computername% with the actual name of the computer,  therefore the only thing that needs changing in the above command is newname, replace it with the name that you want to rename the Server Core computer to.  Once successful the server will request a reboot.

By default, Server Core gets an IP address from a DHCP server, if it cannot find a DHCP server it will give itself one from the 169.254.x.x. range. This is a special IP addresses which is reserved  by IANA for automatic private IP addressing, To configure a static IP address for Server Core, Type the following command

netsh interface ipv4 set address name source=Static address=x.x.x.x mask=x.x.x.x

A little bit if info about this command.  there are no spaces between the = (equals sign),  the address name is the label that has been assigned to the Network Interface Card.  if you have more than one card will read something similar to .

Nic1 =”Local Area Connection”
Nic1 =”Local Area Connection1”

Source= can be DHCP or Static,  if you choose static you will need to add an address=, mask= and an optional gateway=

Next you may wish to join you server to the domain, yep there’s an app for that (sorry CLI command).  Type the following command:

netdom join <ComputerName> /domain:<DomainName> /userd:<UserName> /passwordd:*

here <ComputerName> can be substituted for %computername%,  the /domain: takes the short form ie planetvm rather than planetvm.net.  if you have not supplied the details at the command submission you will be prompted to enter the password for the domain user account you entered,  remember the account has to have the permission to join a computer to the domain. One other thing to note is that it is passwordd that is not a spelling mistake

Once joined, you can restart a Server Core install computer by typing in this command:

shutdown /r /t 0

This command reboots the server with not waiting time,  to power off the machine you will use the command

shutdown /h /t 0

Next, if you want to configure the firewall on ServerCore, you can use the following netsh command:

netsh advfirewall

Now do manage the firewall from the Command line is seriously hardcore and also a royal PITA, so an easier way to manage it is to enable remote management of the Server Core firewall by typing in:

netsh advfirewall set currentprofile settings remotemanagement enable

Now you can cheat and use the Windows Firewall snap-in from a Vista, 7 or Win2K8 machine to connect to the Server Core installation and remotely manage the firewall.

What about changing your timezone, well use this one

control timedate.cpl

what if you want remote access to the servercore desktop,  now remember this will not give you a full desktop but will place you on the console of the machine with the same command line prompt.

cscript %windir%\system32\SRRegEdit.wsf /ar 0

to setup automatic updates on the server use this command

cscript scregedit.wsf /AU 4

Now that you have configured the host, you have got to configure a role,  these are shown in the table below:

Server Role Enterprise Datacenter Standard Web Itanium Foundation
AD Certificate Services x x x o o o
AD Domain Services x x x o o o
Lightweight Directory Services x x x o o o
Branch Cache Hosted Cache x x o o o o
DHCP Server x x x o o o
DNS Server x x x x o o
File Services x x 1 o o o
Hyper-V x x x o o o
Media Services* x x x x o o
Print Services x x x o o o
Web Services (IIS) x x x x o o

x = it is a feature
o = it is not a feature

1 = it is a partial inclusion – only one DFS root allowed.

 

So how exactly do you configure these

well to install Hyper-V use:

start /w ocsetup Microsoft-HYPER-V

to install Active Directory you just use

start /w ocsetup Microsoft-Active-Directory.

well no you don’t, you actually use dcpromo. To do an unattended install of it use the command

dcpromo /unattend:

Now what about the unattended install file, well copy the below and edit it for your own use and place the unattend.txt file in the root of the C drive.

[DCINSTALL]
UserName=administrator
UserDomain=planetvm
Password=s3cr4tW0rd
SiteName=Default-First-Site-Name
ReplicaOrNewDomain=replica
DatabasePath="%systemroot%’NTDS"
LogPath="%systemroot%’NTDS"
SYSVOLPath="%systemroot%’SYSVOL"
InstallDNS=yes
ConfirmGC=yes
SafeModeAdminPassword=s3cr4tW0rd
RebootOnCompletion=yes

if you feel really hardcore you could enter it all on one command line string

Dcpromo /unattend /replicaOrnewDomain:replica /replicaDomainDNSName:planetvm /ConfirmGC:yes

/username:administrator /Password:s3cr4tW0rd /safeModeAdminPassword:s3cr4tW0rd

The above command is split across two lines

Well that is enough for this post,  more to come.

Advertisements

1 comment

1 ping

    • balachandar on September 29, 2010 at 9:45 am

    it was helpful…hw to install a host mgmt software

  1. […] This post was mentioned on Twitter by VM Spotlight, tom_howarth and Jane Rimmer, PlanetVM Net. PlanetVM Net said: new post on PlanetVm.NET – a change from the norm a little post on Server Core https://planetvm.net/blog/?p=1652 […]

Comments have been disabled.

%d bloggers like this: