VMware Communities
axr0284
Contributor
Contributor

Automate running vmware

Hi,

I have an old compile tool that I need to run in windows 7. I was thinking of using vmware workstation to run win 7 as a guest on win 10 host but I want to automate the compilation inside the guest

Can this be done:

1) on windows 10, run a script A that would first copy the files to compile to the shared folder, then it would launch vmware or tell vmware to start another script B is the virtual machine is always running in the background.

2) At that point, I would want vmware to run the window 7 guest (The guest could also be always running technically) and automate running a script B located on the guest os. That script would automatically compile the files in the shared directory and place the result in the shared directory.

3) vmware then should either shut down (I assume script A can detect that the process is finished) or communicate back to script A that the compilation script B is done if vmware is always running but basically some kind of communication between the two scripts A and B

4) Script A would then retrieve the compiled files from the shared directory

Can that somehow be done. If not is there other vmware version that can do that

Thanks,

Amish

Tags (2)
0 Kudos
2 Replies
madodig
Contributor
Contributor

Yes, you can use vmrun.exe:
- to start a VM (if needed, since you said that the guest VM might also be running all the time):
vmrun -T ws start "c:\my VMs\myVM.vmx" [gui|nogui]
- to run a program inside a VM:
vmrun -T ws -gu guestUser -gp guestPassword runProgramInGuest "c:\my VMs\myVM.vmx" "c:\Program Files\myProgram.exe"

vmrun is located in the Workstation installation folder and should be available in the system path. You can also do a lot more with the vmrun command (list running VMs, clone, snapshots, networking).

Instead of using vmrun to run a script inside the guest, you could also use PowerShell remoting (but you have to first configure WinRM in the guest VM). Then, if the VM is always-on, you don't need anything hypervisor related, just PowerShell.

0 Kudos
axr0284
Contributor
Contributor

Very interesting. Thanks for the insight. I will try these

Amish

0 Kudos