Welcome to MSDN Blogs Sign in | Join | Help

Developing on Virtual Server / Hyper-V (RSS)

Information about how to use Virtual Server's COM and Hyper-V's WMI APIs to do interesting things

PowerShell Management Library for Hyper-V

James O'Neill posts here: http://hypervoria.com/hyper-v/hyper-v-powershell-library-now-on-codeplex.aspx to let us know that he has provided a PowerShell Management Library for Hyper-V available here: http://www.codeplex.com/PSHyperv Cheers, Ben

Hyper-V Script: Compact VHD

Continuing on with my walk through the storage WMI API - here are some scripts for compacting VHDs with Hyper-V.  Note that Hyper-V allows you to compact both differencing and dynamically expanding virtual hard disks. PowerShell: # Prompt for the

Hyper-V Script: Validate VHD

Hyper-V provides a handy scripting interface that allows you to validate a virtual hard disk.  You can use this for two main purposes: To confirm that a standard VHD file is correctly structured and not corrupted. To confirm that a differencing disk

Scripting VM Creation with Hyper-V

People have been bugging me for this for a while - so here we go. Here are the VBScripts / PowerShell scripts to create a basic virtual machine: VBScript: Option Explicit   Dim HyperVServer Dim VMName Dim WMIService Dim VSManagementService Dim VSGlobalSettingData

Handling Job Objects with Hyper-V WMI scripting

Many of the methods in the Hyper-V WMI have an odd way of returning status. They can either immediately return a return value - or instead return a job object - and it can be hard to predict which one you are going to get. The reason for this is that

WMI Changes in Hyper-V RC

There have been some changes to the WMI management interfaces in the release candidate of Hyper-V from the previous beta release. While there have been no changes to the model, a number of the strings used in different places have been "cleaned up" to

Mounting a Virtual Hard Disk with Hyper-V

You can mount a virtual hard disk under the parent partition with Hyper-V and a simple script: VBScript: Option Explicit   Dim WMIService Dim VHDService Dim VHD   'Specify the VHD to be mounted VHD = "F:\Windows.vhd"   'Get instance

Renaming a Hyper-V Virtual Machine

Moving on we come to a sample script for changing a setting on a virtual machine - in this case I am changing the virtual machines name. VBScript: Option Explicit   Dim WMIService Dim VM Dim VMManagementService Dim VMSystemSettingData Dim VMName

Shutting down a Hyper-V Virtual Machine

Now to get a little trickier - shutting down a virtual machine: VBScript: Option Explicit   Dim WMIService Dim VMList Dim VMName Dim VMGuid Dim ShutdownList Dim Result   'Specify the name of the virtual machine that I want to shutdown VMName

Starting a Hyper-V Virtual Machine

Next in the line up of scripts - another simple one - starting a virtual machine: VBScript: Option Explicit   Dim WMIService Dim VMList Dim VMName   'Specify the name of the virtual machine that I want to start VMName = "Windows Server

Bring on the Scripts!

Okay! Now that initial documentation of the Hyper-V WMI API is available I thought I would respond with a "Week of Hyper-V Scripts". Starting with a simple one - here is a script that will list the name, identifier and state for each virtual

Mounting VHDs from Managed Code

When Virtual Server 2005 R2 SP1 was released it included the VHDMount tool - that came with a DLL to allow you to control it programmatically.  Unfortunately we were rather light with the documentation / sample code for this.  So today I would

Looking at the GuestOS.ComputerName property

Virtual Server 2005 R2 SP1 added a few new bells and whistles to the COM API. One of these is the GuestOS.ComputerName property. This property allows you to get the network name of the virtual machine through the COM API. Option Explicit Dim vs, vm, vmName,

VBScript to uniquely assign MAC addresses across servers

A while ago I was asked if I had a script that could assign a unique static MAC address to a virtual machine. I did not - and thought I would write one - which turned out to be a lot more effort than I thought! To give some background here - Virtual Server

A New Book on Virtual Server - written by me!

Time for me to unveil a personal secret - I have written a big honkin' book about Virtual Server. For more details - check out this write up that I have made which details everything that you can find inside. Cheers, Ben
More Posts Next page »
 
Page view tracker