I will try to ask this question clearly, but i ask that you read it carefully as I may not do a great job of clearly stating what I am looking for.
I know how to create a virtual disk in a batch file or a script. I know how to have a running VM detect a newly added hard disk and format it in Linux, DOS, and NetWare. I have not yet scripted that part, but I have done it manually by adding drives through the user interface and then manually doing the steps to make the OS detect and format the newly added drive. In each case, all of those steps are scriptable except for the adding of the drive in the UI.
The only way that I know to add a new hard disk to a running VM is through the user interface. I do not know of a scriptable way (such as vmrun or an API call) to do that.
I assume that in a pinch that I can have the VM go into standby and then add the hard disk to the vmx file while the machine is in standby, then bring the machine out of standby, although I haven't tested this.
My question is, "Can a virtual disk be added to a running VM without using the user interface, and without placing the machine in standby, or in other words in a script of some sort?"
Have you tried VI SDK?
Have you tried VI SDK?
I did not see anything in the VI SDK that would do this, but I could easily be overlooking something. Do you have something specific that you suggest that I look at?
in powershell you can do this fairly easily, not sure if you wanted to use powerhsell but the new-harddisk command works great.
I'm also looking to know if it is possible to do that, that is, change the settings of a VM while it is running, but more specifically, attach an existing vmdk to the VM in vmware workstation. I've checked the VIX API and vmrun.exe, but there is nothing that mentions that.
The powershell seems to be only for server products right ? So, is there a way to to that in VMWare Workstation ?
Thank you,
Frank.
I've not heard of any way to do this.
I now believe that the answer that suggested using the VI SDK is correct.
It's just that it's not a simple command like calling some of the VMRun commands, but after looking more closely I believe that it could be done that way.
I would need to get some experience with programming using it before I could do it.
Thanks to the person who suggested using powershell. Because of some requirements that I have that I did not state above that is not usable in my case, but other people should certainly consider it.
Have you found any specific objects in the VI or PowerCL that you think would work?
Ok, correction. There's no way to do this -- for workstation. I misunderstood the question it seems. For ESX it is possible.
In PowerCLI you can use New-Harddisk. Through the API you can use ReconfigVM, though the exact parameters are pretty tricky. Sorry for the wrong info.
Chris,
What I did was use one of the html "spy" programs to intercept communications between the browser and the host machine. I ran this locally on the machine and used the unencrypted port. I then added a drive, and I saw the sequence of events. I looked up some of the calls and saw that they were indeed documented in the API manual (as opposed to being some sort of undocumented functions). In a nutshell, you have to initilaize your program, then make some calls to hook up the drive. I don't remember any of the calls, but it did not appear hard, but it wasn't trivial either.
You will be doing this by writing a program in C (or java, or maybe some other language) and making these calls. If you have the expertise to do what I said above then that will allow you to find what you need to do. If you are unable to follow what I said above, then you will most likely be unable to program this to work. It's a completly different ballgame from the vmrun commands.
This should work on ESX and VMware server. I did my testing on VMware server.