Clone a Hyper-V VM

  • First step build the VM to your liking
  • Make a cup of tea
  • Run sysprep i.e. c:\windows\system32\sysprep\sysprep /generalize /oobe /shutdown
  • Rename the VM in Hyper-V Manager i.e baseline
  • Export the VM from Hyper-V Manager
  • Don’t forget to drink the cup of tea
  • Rename the VM back to it’s original name
  • Copy the exported directory. I’m using Hyper-V Server R2 so Robocopy is easiest i.e. “robocopy /E d:\Baseline d:\VM\NewVM”
  • Rename the VHD file and update the name in config.xml and in the EXP file
  • Import the Cloned VM in Hyper-V Manager
  • Rename the Cloned VM and run through the mini-setup
  • Your Done!

SCOM – Notification Test Tool

Notification Test Tool

The Notifications Test Tool is a simple tool you can use to test your notification channels and subscriptions. This tool can be used to test email (SMTP), Instant Message (IM) or Text message (SMS) channels. Also, you can use this to generate a test alert in OpsMgr to test subscriptions.

Install Instructions:

Download and install the OMTestTool.msi to a local directory on your computer.

Note: This tool must be installed on a computer that has the OpsMgr console installed and run from someone logged as a local admin. To run the tool you must me a member of the OpsMgr Administrator group.

I have included a small user guide in the zip file. This tool will work on all version of OpsMgr. I plan to update this tool to support multiple channels types that R2 now exposes when I get some time.

Note: If you are running this tool on an OS where UAC is enabled please make sure to right click and run as Administrator.

Enjoy!

Rob Kuehfus | System Center Operations Manager | Program Manager

http://blogs.technet.com/momteam/archive/2009/05/19/notifications-test-tool.aspx

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.