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…
- Detach existing VHD
- Delete VHD
- Create a new Differencing VHD with base VHD as already good setup
- Attach it to the VM
- 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.
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.