Archive for February, 2010

Backup Hyper-V

It is possible to backup a Hyper-V server without taking it down using the Hyper-V VSS writer.

The way I do it is with a small batch file that is run as a scheduled task. The command is quite simple.

WBADMIN START BACKUP -backupTarget:”\\SERVER\BACKUP_SHARE” -user:DOMAIN\USERNAME -password:PASSWORD -include:C:,D: -vssFull -quiet > c:\Backup\hyperbackup.log

As you can see the command is output to a text file located at c:\Backup\hyperbackup.log so that you can check the progress.

As I will always forget to check on it I set another scheduled task to run a VBS file to e-mail the log to me.

This is the vbscript I use.

Const cdoSendUsingPickup = 1 ‘Send message using the local SMTP service pickup directory.
Const cdoSendUsingPort = 2 ‘Send the message using the network (SMTP over the network).

Const cdoAnonymous = 0 ‘Do not authenticate
Const cdoBasic = 1 ‘basic (clear-text) authentication
Const cdoNTLM = 2 ‘NTLM

Dim arrFileLines()
i = 0
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
Set objFile = objFSO.OpenTextFile(“LOCATIONOFFILETOEMAIL“, 1)

Do Until objFile.AtEndOfStream
Redim Preserve arrFileLines(i)
arrFileLines(i) = objFile.ReadLine
i = i + 1
Loop
objFile.Close

Set objMessage = CreateObject(“CDO.Message”)
objMessage.Subject = “SUBJECT
objMessage.From = “”"FROM“” <FROM@DOMAIN.co.uk>”
objMessage.To = “TO@DOMAIN.co.uk

For l = Ubound(arrFileLines)-10 to Ubound(arrFileLines)

‘ write the output to the file
objMessage.TextBody = objMessage.TextBody + arrFileLines(l) + VbCrLF
Next

‘objMessage.TextBody = “This is some sample message text..” & vbCRLF & “It was sent using SMTP authentication.”
objMessage.AddAttachment “LOCATIONOFFILETOEMAIL

‘==This section provides the configuration information for the remote SMTP server.

objMessage.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/sendusing”) = 2

‘Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/smtpserver”) = “SMTPSERVER

‘Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/smtpauthenticate”) = cdoBasic

‘Your UserID on the SMTP server
objMessage.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/sendusername”) = “USERNAME

‘Your password on the SMTP server
objMessage.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/sendpassword”) = “PASSWORD

‘Server port (typically 25)
objMessage.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/smtpserverport”) = 25

‘Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/smtpusessl”) = False

‘Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objMessage.Configuration.Fields.Item _
(“http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout”) = 60

objMessage.Configuration.Fields.Update

‘==End remote SMTP server configuration section==

objMessage.Send

To save having to open the attachment the last ten lines (or so!) are in the body of the e-mail. This allows you to see if the backup has been successful or failed at a glance.

Installing Hyper-V

Here is my process for installing Hyper-V on a Windows 2008 Server.

Basic install

First make sure the hardware can support virtualisation. Securable is the easiest tool for this.

If Securable shows a failure check these setting (names may vary) in the BIOS

  • Security > Execute Disable (set to On)
  • Performance > Virtualization (set to On)
  • Performance > VT for Direct I/O Access (set to On)
  • Performance > Trusted Execution (set to Off)

Next install Server 2008 Enterprise as normal

Once the install has finished install all drivers, run windows update and add to the domain (or not).

Run Add Roles from server manager and select Hyper-V.

On the virtual networks page select the adapter(s) you want to use to give physical network access.

Complete the installation process and reboot the server. Log back in with the same account you started the install with and let it finish the install proccess.

You can now create / manage the virtual network / machines from server manager or from the Hyper-V mmc snap-in.

Additional Steps

I use the Hyper-V Monitor gadget to monitor my virtual servers. This gadget relies on pinging the server as part of the monitoring process. By default ICMP is blocked by the windows firewall. The easiest way of enabling ICMP is from the command prompt with the line

netsh firewall set icmpsetting 8

And your done!

Remote support for family and friends

I used to use Reverse VNC to give remote support to family members but the driver doesn’t work on Vista and above, or it doesn’t for me anyway.

So I now use TeamViewer. It’s free for personal use and works with both Windows and (rotten) Apple’s.