July 2008 Archives

Today I got some time to myself.   A rarity.   And thus I got to really play with Hyper-v (Formerly known as Windows Server Virtualization, mostly I think because Hyper-V is so much cooler sounding.. :) )

Now just to let you know, I am cheap. I have no budget.  So my Virtualization environment has to fit that budget. 

So what do you need?

Uhhh... You need a computer (SLAP!)

Yeah I felt that one coming. 

Ok, reality.  You need a processor with 64bit capability. Itanium will not cut it.  Newer Intel / AMD chips and most newer Xeon processors will have this.

It needs to support Virtualization at a hardware level on the CPU directly.  Again, not all chips have this and you will need to research.  But mine is a 2.4 Ghz Core2 chip 6600 series.   Pretty budget minded if you look on eBay or even your local shop.   The board for my chip was about $200.

Four gig of ram (you can do it with 2 though, I did to start) is about $100.

You can run it on any hard drive but a 500 gig is just about $100 as well.

So with a budget of about $500 you can have the guts to play.  and I do mean PLAY!

If you don't have the budget to Buy Server 2008 and you're just a guy like me, you have two options.  You can download the Trial media from Microsoft for free.  I believe it runs for 120 days if not 180.

Or if you can swing it, get "Technet Direct".  It's normally $300 but look about on the internet.  Microsoft has been having it on special for $200.  That will get you just about every operating system and server application they have to play with for a FULL YEAR (Even comes with two of those very expensive product support calls included!)

Now just so you get a feel for what you can do with this power, here's what I am doing right now.

Running 7 operating systems side by side.  Server 2008, Server 2008 with Exchange 2007, Server 2008 Core, Server 2008 in Terminal Mode, Server 2003 and Server 2003 with Exchange 2007 with a Vista workstation to boot.  All in 64 bit mode.

All happy.  

Granted this is NOT best practice.  But my overall cpu is not spiking at all.  I'll give you more details later tonight as I start loading it up but it is absolutely amazing what you can pull off with this.    And the more ram you throw at it.  The faster she goes... :)

Sean
The Energized Tech
Dedication and Inspiration creating the new Generation

Well we're sitting down in front of our Server 2008 Core install.    If you're lazy like me, you just dropped in the media, let it run and install.  Now you want to play.

But wait, what name does the computer have?

"Oh easy!" You say to yourself. "I'll just pop into the "Properties" of the "System" and check the name from there.  

Oh right.  No GUI.

Panic sets in.     The boss is screaming.  "I need that new server online.  We need SRV2K8CORE online now. MOVE IT OR YOU'RE WORKING FOR the Burger King!"

Bosses say things like that.  It's called "Employee incentive."  Lawyers call it "Potential Cashflow."

But back to reality.  You need to name this thing something other than the random "WIN-2349FNS" that the media created for you.

So how to start?

Surprisingly it's very easy.  Another thing that, once done; you can throw into a script rather than remembering all that nonsense.  

I mean nobody actually memorizes these commands right?  That would be so... so ... NERDY!

So at your command prompt (Because that's all ya got in Core buddy!) type in

HOSTNAME

You'll get some answer like

"SERVER"

or

"WIN-2345918H1"

or

"JABBERWOCKY"

Whatever obscure or meaningful name it coughs up, that is the PRESENT name of your server.  Renaming is easy.  Just type in

/Alt/Sub Hyper -$%#@@ ^JOj8 !!! DIR -- #$%! INSERT ....

No I was pulling your chain, it's actually simpler and makes sense

You can use the NETDOM.EXE command.   This is your equivalent to the "Network Identifcation" tab from before in GUI land.

So at your command prompt key in

NETDOM RENAMECOMPUTER /?

For help in playing with this command.  You'll get the following screen.

NETDOM RENAMECOMPUTER machine /NewName:new-name
           [/UserD:user [/PasswordD:[password | *]]]
           [/UserO:user [/PasswordO:[password | *]]]
           [/Force]
           [/REBoot[:Time in seconds]]
           [/SecurePasswordPrompt]

NETDOM RENAMECOMPUTER renames a computer. If the computer is joined to a
domain, then the computer object in the domain is also renamed. Certain
services, such as the Certificate Authority, rely on a fixed machine name.
If any services of this type are running on the target computer, then a
computer name change would have an adverse impact. This command should not
be used to rename a domain controller.

machine is the name of the workstation or member server to be renamed

/NewName        Specifies the new name for the computer. Both the DNS host
                label and the NetBIOS name are changed to new-name. If
                new-name is longer than 15 characters, the NetBIOS name is
                derived from the first 15 characters

/UserD          User account used to make the connection with the domain.
                The domain can be specified as "/ud:domain\user". If domain is
                omitted, then the computer's domain is assumed.

/PasswordD      Password of the user account specified by /UserD. A * means
                to prompt for the password

/UserO          User account used to make the connection with the machine to
                be renamed. If omitted, then the currently logged on user's
                account is used. The user's domain can be specified as
                "/uo:domain\user". If domain is omitted, then a local computer
                account is assumed.

/PasswordO      Password of the user account specified by /UserO. A * means
                to prompt for the password

/Force          As noted above, this command can adversely affect some services
                running on the computer. The user will be prompted for
                confirmation unless the /FORCE switch is specified.

/REBoot         Specifies that the machine should be shutdown and automatically
                rebooted after the Rename has completed. The number of seconds
                before automatic shutdown can also be provided. Default is
                30 seconds

/SecurePasswordPrompt
                Use secure credentials popup to specify credentials. This
                option should be used when smartcard credentials need to be
                specified. This option is only in effect when the password
                value is supplied as *

NETDOM HELP command | MORE displays Help one screen at a time.

 

As you can see, a pile of information is presented.  But I can see from the top line, the one I want is really obvious.

NETDOM RENAMECOMPUTER machine /NewName:new-name

There are additional parameters I can add, like my credentials in order to be allowed to rename it, force a reboot etc.  But all I want is to name this silly machine to something normal before my boss gets ideas about transferring me to the sanitation division.

So in my case my computer was called

"WIN-2345918H1"

Because as I said before, I was lazy, shoveled in the media and just went with it.

So quickly typing

NETDOM RENAMECOMPUTER WIN-2345918H1 /NewName:SRV2K8CORE

Now PRESUMING you had the credentials to do that and you didn't break any other rules (like I don't know, renaming a Domain Controller in the process.  Nobody would do that right?) you now have a Windows 2000 Core box called "SRV2K8CORE"

We've got to reboot our little friend to make it live as the new name.  We could just cheat, do a CTRL-ALT-DELETE and click the red button to restart the machine.  But what fun would that be?

Please allow me to introduce one more command.  SHUTDOWN.

Embrace the shutdown command.   It is your friend.  Use it more often than the GUI version.  It's easy to remember and powerful and ALWAYS REBOOTS (Well except for the power outage, couldn't get it to work then for some reason.)

We'll go into further details on this command later but in a nutshell type in

SHUTDOWN -F -R -T 0

This will FORCE an immediate REBOOT in 0 TIME (Pick up the hint what it means?)

In a short reboot time you will have a core server online with a real name.

Next time, we'll look into making it as a Domain Controller.

Sean
The EnergizedTech -
Dedication and Inspiration creating the new Generation

Well folks we're all sitting here at this pretty core screen on Server 2008.  The cursor is just a blinking away on "C:\Users\Administrator".  Just teasing you and poking fun at you.

"No GUI! Come on! Gimme your worst!"

You feel so helpless. 

But you aren't.

Helpless would be un-armed.  No way to work.  System useless.

Today we're going to play a little bit with NETSH.EXE

"And just what is THAT?!" they're all screaming at the back.

Potatoes fly down.  "I thought you were going to tell us something useful!  We just use that sometimes after spyware!"

Well in truth you do.  NETSH INTERFACE IPV4 RESET is a nice simple way to reset the Winsock in your system.  But that's not ALL it does.  Do you think Microsoft put it there BECAUSE of Malware?

Nope.

NETSH.EXE is your command line version of "Network Connections" or "Network Sharing Center".   This is your magic box to get into network card settings.

Now NETSH.EXE like a LOT of the command based utilities is incredibly powerful.  I particularly like it since it has both a regular "Shell" to dip into which actually has a simple and useful help system.

It can also be pre written up as a batch file or scriptable command line.

If you just typed in your old familiar NETSH INTERFACE IPV4 RESET you would have just seen it say "Yeah ok, whatever." and finished it's job.

If however you typed in NETSH.EXE by itself you'd get

netsh>

Seems to be prompting you for something doesn't it?

Key in either "help" or "?" and hitting enter will open up this little world.

The following commands are available:

Commands in this context:
..             - Goes up one context level.
?              - Displays a list of commands.
abort          - Discards changes made while in offline mode.
add            - Adds a configuration entry to a list of entries.
advfirewall    - Changes to the `netsh advfirewall' context.
alias          - Adds an alias.
bridge         - Changes to the `netsh bridge' context.
bye            - Exits the program.
commit         - Commits changes made while in offline mode.
delete         - Deletes a configuration entry from a list of entries.
dhcp           - Changes to the `netsh dhcp' context.
dhcpclient     - Changes to the `netsh dhcpclient' context.
dump           - Displays a configuration script.
exec           - Runs a script file.
exit           - Exits the program.
firewall       - Changes to the `netsh firewall' context.
help           - Displays a list of commands.
http           - Changes to the `netsh http' context.
interface      - Changes to the `netsh interface' context.
ipsec          - Changes to the `netsh ipsec' context.
lan            - Changes to the `netsh lan' context.
nap            - Changes to the `netsh nap' context.
netio          - Changes to the `netsh netio' context.
offline        - Sets the current mode to offline.
online         - Sets the current mode to online.
p2p            - Changes to the `netsh p2p' context.
popd           - Pops a context from the stack.
pushd          - Pushes current context on stack.
quit           - Exits the program.
ras            - Changes to the `netsh ras' context.
rpc            - Changes to the `netsh rpc' context.
set            - Updates configuration settings.
show           - Displays information.
unalias        - Deletes an alias.
winhttp        - Changes to the `netsh winhttp' context.
winsock        - Changes to the `netsh winsock' context.
wlan           - Changes to the `netsh wlan' context.

The following sub-contexts are available:
advfirewall bridge dhcp dhcpclient firewall http interface ipsec lan nap netio
p2p ras rpc winhttp winsock wlan

To view help for a command, type the command, followed by a space, and then
type ?.

 

"WHOA!" I can hear you say.  "THAT'S inside NETSH.EXE?"

That's right.  Now the fun part is playing with it.   Let's try something simple.  I'll go in step by step.  Mostly because I personally can't remember all the command structure.    Setting an IP address.  This is of course PRESUMING you have a network card installed.   Of some type.

Now I can do the showoff version which says "JUST TYPE THIS IN, IN ONE SHOT.  NOW GO AWAY AND STOP BOTHERING ME FOR ANSWERS."

I COULD do that, but that would be rude and not very interesting.

So enter the "Net Shell"

NETSH (Of course hit Enter, really, you DO have to.... Hey who threw that?)

netsh>

Now at this prompt type "interface" to choose the particular interface you're going to work with

netsh>interface <ENTER> (Don't type <ENTER> or this won't work.... Hey you at the back, I know where you live)

netsh interface>

Is your new prompt.  You see as you go in it will remind you what you're doing.  This will also be part of the context if you ever wanted to write this as a batch file and drop it onto another system.

now choose tcp since we're going to work with TCP/IP.  By the way, I'm not picking "random words".  If you're curious where they're coming from, any time, key in "?" or "HELP" to get a gander what you can do at each level of the tree.

netsh inteface>tcp (We'll skip all the Enter jokes from here on in, that joker at the back is really pelting me)

Today we're going to work with IPV4.  What you didn't read? There's more than one version of TCP/IP.  We want to work with THAT version.   I'm certain we're all running a TCP/IP V6 class network in our house.

netsh interface tcp>ipv4

Now at all these points there's a pile of commands you can mess with.  Some dangerous and some simple.  I like the simple ones.  They keep me out of trouble.  "show" is one of them.  Pretty obvious what it wants.  At the prompt key in "show" after you see

netsh interface tcp ipv4> (You remembered to Enter before, ri....*OUCH* stop that!)

netsh interface tpc ipv4>show

The following commands are available:

Commands inherited from the netsh context:
show alias     - Lists all defined aliases.
show helper    - Lists all the top-level helpers.
show mode      - Shows the current mode.

Commands in this context:
show addresses - Shows IP address configurations.
show compartments - Shows compartment parameters.
show config    - Displays IP address and additional info
show destinationcache - Shows destination cache entries.
show dnsservers - Displays the DNS server addresses.
show dynamicportrange - Shows dynamic port range configu
show global    - Shows global configuration parameters.
show icmpstats - Displays ICMP statistics.
show interfaces - Shows interface parameters.
show ipaddresses - Shows current IP addresses.
show ipnettomedia - Displays IP net-to-media mappings.
show ipstats   - Displays IP statistics.
show joins     - Displays multicast groups joined.
show neighbors - Shows neighbor cache entries.
show offload   - Displays the offload information.
show route     - Shows route table entries.
show subinterfaces - Shows subinterface parameters.
show tcpconnections - Displays TCP connections.
show tcpstats  - Displays TCP statistics.
show udpconnections - Displays UDP connections.
show udpstats  - Displays UDP statistics.
show winsservers - Displays the WINS server addresses.

My goodness this is pile more.   Well in this case I'm interesting in viewing my current IP address and how it's been setup.   And believe it or not, it's obvious!

netsh interface tcp ipv4>show addresses

In my case I get these off my test machine.

Configuration for interface "Local Area Connection"
    DHCP enabled:                         No
    IP Address:                           10.0.0.49
    Subnet Prefix:                        10.0.0.0/24 (mask 255.255.255.0)
    Default Gateway:                      10.0.0.1
    Gateway Metric:                       256
    InterfaceMetric:                      20

Configuration for interface "Loopback Pseudo-Interface 1"
    DHCP enabled:                         No
    IP Address:                           127.0.0.1
    Subnet Prefix:                        127.0.0.0/8 (mask 255.0.0.0)
    InterfaceMetric:                      50

 

So here's where you get useful information about the IP address and gateway typing "show dnsservers" in this context gets you a list of DNS Servers in use, "show interfaces" will show you the descriptive name of all your network cards.  This comes in handy with the next step.  SETTING your IP address. 

netsh interface tcp ipv4>set address

If you just typed "set" by itself it would show you all the things you can "set".  Right now I just want to "SET" my ip address so I can do something with this.   Keying "set address" by itself will give me more instructions.  But I want to "SET" my IP address before my coffee gets cold.

netsh interface tcp ipv4>set address name="Local Area Connection" source=static 192.168.1.20 255.255.255.0 192.168.1.1

Ding.  Now I have the IP address changed to 192.168.1.20

Now if you want to forget how to do all this in the future, because you're lazy; like me.   Get out your copy command and paste that whole line into notepad and save it as a BAT or CMD file.  Then just edit the IP address later for the next machine.  Take out the ">" from the line of course so it reads.

netsh interface tcp ipv4 set address name="Local Area Connection" source=static 192.168.1.20 255.255.255.0 192.168.1.1

But what if the name of the Lan Connection was "Server Connection" or more importantly what if I have SEVERAL network cards?   the "show interfaces" lists them all by name.  You can modify the section that says "Local Area Connection" with whatever names are assigned to your card.

There's a lot more power to the command line than just setting an IP address, like allowing firewall exclusions for example.  The great part is.  It's not bandwidth intensive.   Copy, paste, run.  

Next time we'll touch on other commands like how to rename your computer or maybe join it to a domain.

Until next time

Sean
The EnergizedTech -
Dedication and Inspiration creating the new Generation

Had some time to myself this weekend, a little time to stretch creatively and play. 

So I finally sat down and blanked off my Dual Core box.    Finally Sat down and put in Server 2008 Core.

The operation isn't difficult.  I just had the usual pile of rubbish I didn't know where to put it. 

So I picked a good spot.   The Recycle Bin.  Nothing ever gets lots in the Recycle Bin right?  Best place for archiving data.

No?

Oh well then.  I guess live and learn

So I downloaded a fresh copy of the media from Technet.  One of the nicest things you can get your hands on is Technet Direct.   For about $300 per year, you get access to almost every key application from Microsoft. 

No 120 day timeouts.  No Catch 22.  Pretty sweet.  Plus two technical support incidents from Microsoft.  Very impressive.

So installing Core.   Just popped in the media, Installed the O/S.  Chose a "Core Server 2008 Enterprise" install.   Let that puppy run through.  I think in barely half an hour I had Core installed and running.

So what to do now?  You've got a server with no GUI and minimal apps.   But the wonderful thing is you haven't lost any power.   In fact you've gained.   So much resources available at your finger tips.

What can core be?

How about.

Hyper-V Virtual environment

File and printer Server

Web server

Domain Controller

and so much more.   

What is impressive is would think that with no MMC to run and manage directly, you'd be dead in the water.  But no.  No.

Not at all.  Not one tiny bit.

Everything you need to do in core (well say about 90%) can be done at the command Prompt.   The Oh so Mighty command prompt.  Including managing that wonderful built in Firewall.  OH yeah!

Next time I'll try and touch on some of the built in shell commands.  Maybe show the rest of us who didn't realize the power Microsoft has sitting on a command prompt.

And so far this is before getting into Powershell.   

Until next time folks

Sean
The EnergizedTech -
Dedication and Inspiration creating the new Generation

Energized Tech

| | TrackBacks (0)

That's right folks.   Thanks to the fine team at Microsoft Canada and Energize IT.  I am now an Energized tech.   On this particular site, I will probably be blogging about whatever strikes me as neat, interesting or just particulary gets me geeky.

 

Stay tuned.  It's about to get weird.

 

Sean