Could it be Windows 7 + RunProgramInGuest?

Mar 1, 2010 at 11:41 AM

I'm trying to evaluate this library, and my scenario is:

Host: Windows 7, 64b

Guest: Windows Vista 32b

When I run this program the script stops when I try to run virtualMachine.RunProgramInGuest("notepad.exe", string.Empty);

What could it be?

 

 

           VMWareVirtualHost host = new VMWareVirtualHost();
            host.ConnectToVMWareVIServer("127.0.0.1:8333", "miguel.marques", "1234", 15);
            Console.WriteLine("Connected");

            using (VMWareVirtualMachine virtualMachine = host.RegisteredVirtualMachines.First<VMWareVirtualMachine>())
            {
                // power on this virtual machine
                virtualMachine.PowerOn();
                // wait for VMWare Tools
                virtualMachine.WaitForToolsInGuest();
                Console.WriteLine("Tools");
                // login to the virtual machine
                virtualMachine.LoginInGuest("primavera", "1234");
                Console.WriteLine("Logon");
                // run notepad
                virtualMachine.RunProgramInGuest("notepad.exe", string.Empty);
                Console.WriteLine("Notepad");
                // create a new snapshot
                string name = "New Snapshot";
                // take a snapshot at the current state
                virtualMachine.Snapshots.CreateSnapshot(name, "test snapshot");
                // power off
                virtualMachine.PowerOff();
                // find the newly created snapshot
                using (VMWareSnapshot snapshot = virtualMachine.Snapshots.GetNamedSnapshot(name))
                {
                    // revert to the new snapshot
                    snapshot.RevertToSnapshot();
                    // delete snapshot
                    snapshot.RemoveSnapshot();
                }
            }

Coordinator
Mar 1, 2010 at 12:17 PM

Does notepad start? I bet it just starts non-detached, try DetachProgramInGuest.

Mar 1, 2010 at 1:40 PM
Edited Mar 1, 2010 at 1:43 PM

Hello!

Thanks for the quick reply.

 

The problem is that appeared a message from the "Interactive Services Detection" that is a service that is running on the Guest OS.  After I read some other post I changed this two lines and added the parameter to do logon interactively.

virtualMachine.LoginInGuest(

"primavera", "1234",8,20);

Console.WriteLine("Logon");// run notepad

virtualMachine.RunProgramInGuest(

"notepad.exe", string.Empty,2,50);

 

After a reset to the Guest OS the machine started to do logon and the notepad opens but stays opened and the code stops here. That can lead to your answer that I will try to do know.

 

p.s. When the service is stopped i get this message: "The specified guest user must be logged in interactively to perform this operation"