0

PowerCLI: Adding New PortGroups

I’m sure that someone somewhere has written a script exactly like this in the past but I wanted to write my own for a number of reasons. While I’ll probably never be a PowerCLI hero, it really doesn’t hurt to keep in practice and hone your skills.

Let’s start with what I want to accomplish. I’m working with an ESX 3.5 web hosting environment and there’s a new project in the pipelines. A brace of new servers are required and they’ll be on a new VLAN. The VLAN has been created and configured on the various switches that the ESX hosts connect to but now of course a corresponding PortGroup is required. (Actually two are needed – complex project.) Now we’re not talking about a huge number of hosts here. It would probably only take 10 minutes to do it by hand using the VI client. It’ll take me longer to write this post! However, it is something that happens relatively often in this environment so it’s worth taking the time to write a script. Continue Reading

0

Configure 2008 Server Core Networking

So you’ve installed Windows Server 2008 Core, you don’t use DHCP and you want to get the thing on the network. I keep forgetting how to do this so I thought I’d create this post to help me remember!

I’m assuming that you’ve got as far as changing the administrator password and logging in. The next step is as easy as typing a few commands into the plain black window you see in front of you. For this example, let’s assume that we want the server to have the following network configuration:

HOSTNAME: win2008core

IP ADDRESS: 10.1.5.16

SUBNET MASK: 255.255.255.128

DEFAULT GATEWAY: 10.1.5.126

DNS SERVER: 10.10.20.6

DNS SERVER: 10.20.4.3

We first have to extract two pieces of information from the server. The current hostname and the index of the NIC that we want to configure.

The hostname can be acquired simply by entering the command:

[text]hostname[/text]

This will return something like “WIN-87abac8chasa87” or something random like that. Make a note of the name returned as we’ll need it later.

Next enter the following command:

[text]netsh interface ipv4 show interfaces[/text]

This will return an output a bit like the one below. The important thing though is getting the index (Idx) value for the interface that you’re interested in (3 in this case). By default this will probably be called “Local Area Connection”.

screenshot_2009-12-03_12-58-49

To setup the IP details for the interface just enter the following command:

[text]netsh interface ipv4 set address name="3" source=static address=10.1.5.16 mask=255.255.255.128 gateway=10.1.5.126[/text]

To add the DNS servers to this interface, use the following commands:

[text]netsh interface ipv4 add dnsserver name="3" address=10.10.20.6 index=1
netsh interface ipv4 add dnsserver name="3" address=10.20.4.3 index=2[/text]

Note that we incremented the index value in the second command.

That was quite easy really. All that remains is to rename the server. This is done with another simple command using the value that we obtained earlier:

[text]netdom renamecomputer WIN-87abac8chasa87 /NewName:win2008core[/text]

All that you then need to do is reboot the server:

[text]shutdown /r /t 0[/text]