views:

19

answers:

1

I have virtual machine that has windows 7 + visual studio 2010 setup, and my plan is to test some VS SDK development. Now I want to automate following tasks...

  1. Detach existing VHD
  2. Delete VHD
  3. Create a new Differencing VHD with base VHD as already good setup
  4. Attach it to the VM
  5. Start VM

I tried to look for any OCX or COM control to do these tasks automatically but no luck, I didn't find any COM library to do this.

However, if I can only delete and recreate a differencing VHD that also should be fine..., I know I can write to batch file to copy a backup of new VHD and do all these kinds of things, but I am looking for much more sophesticated solution where I can program in scripts and do more with it.

+1  A: 

There's an extensive automation interface for Virtual Server, but not for Virtual PC. I don't have it installed on my machine to help you find it. But you can probably find it yourself. Fire up regedit.exe and navigate through HKCR. There should be a ProgId named some similar to "VirtualMachine.Application". Note the CLSID guid. Navigate to HKCR\CLSID\{guid} and note the InProcServer32 key value. That should be the DLL that you can browse to in the Browse tab of the Add Reference dialog.

Hans Passant
Hi, thanks for the info, this is what exactly I am looking for but can you tell me from where I can get TLB or how to I get everything in C#?
Akash Kava
Erm, that's what I did.
Hans Passant
Well the msdn help specifies GUID and interface information, I have to actually type everything in order to get into C#, but I want to know how can I import any DLL that will generate C# interfaces.
Akash Kava
Did you start Regedit.exe yet?
Hans Passant
I found typelib GUID that is "{CEF63746-AD34-42D0-9138-39D83ECB77CB}" after going in regedit, and tried navigating couple of guids mentioned there and in msdn, but no luck, you cant find dll easily for windows components, i remember, even for directshow there was none and somebody created project in sourceforge that had all interfaces documented, its quite painful job, however it says in windows SDK i can find tlb, let me try downloading that.
Akash Kava
I downloaded and installed it, no dice. Then found a feature comparison, the scripting interface is only available for Virtual Server, not Virtual PC. http://www.microsoft.com/downloads/en/details.aspx?FamilyID=8ed0a6cb-0f24-408e-af8f-51edf508d361
Hans Passant