Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8752489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:14:43+00:00 2026-06-13T13:14:43+00:00

I am at a loss on how to use the VIX api to install

  • 0

I am at a loss on how to use the VIX api to install my software under test as part of what hopefully will be an addition to my continuous integration. Here are the operations at a high level:

  1. power on VM snapshot
  2. Install an msi package on the VM using RunProgramInGuest (this msi is my software under test)
  3. shutdown the VM
  4. take snapshot

Now – these steps work fine if I first manually log into an already-powered-on snapshot and just start my program in step 2. Everything just works. However, if I start at step 1 and allow VIX to power on the snapshot, my RunProgramInGuest just doesn’t do what it normally would had I been logged in already

In the guest VM, I have:

  • A .bat file on the desktop which calls a Task created through Task Scheduler. This task is set to run with Highest privileges. I am using the ideas from Using VMRUN with Windows Vista and UAC. Although note: I have UAC completely turned off for now so this is not the issue
  • The Task from above will run a different .bat file on the desktop which is my installation script e.g. msiexec /i …

The code which the host runs which is choking unless I am already logged into the VM:

using (VMWareVirtualHost virtualHost = new VMWareVirtualHost()) {
    virtualHost.ConnectToVMWareWorkstation();

    using (VMWareVirtualMachine virtualMachine = virtualHost.Open(@"D:\VMware-VMs\testvm-W7x86-3\testvm-W7x86-3.vmx"))
    {

        virtualMachine.PowerOn();
            virtualMachine.WaitForToolsInGuest();  
        virtualMachine.LoginInGuest("myusername", "myfakepassword");

        VMWareVirtualMachine.Process guestProcess = virtualMachine.RunProgramInGuest(@"C:\Windows\System32\cmd.exe", @"/c C:\Users\myusername\Desktop\StartTask.bat", Constants.VIX_RUNPROGRAM_ACTIVATE_WINDOW);
        Thread.Sleep(60000);
        virtualMachine.RunProgramInGuest(@"C:\Windows\System32\cmd.exe", @"/c C:\Windows\System32\shutdown.exe -s -t 0");
        Thread.Sleep(30000); //wait for guest to shutdown before continuing to make snapshot..

…and so forth

My questions:

  • Why is it that this is only working when I am already logged into the already powered on VM?
  • Is there another way I should go about doing this, outside of using the VIX api (e.g. such as using Psexec.exe or something similar)? The way this is set up using a Task set to run with Highest privs – this means that any VM I want to bring into the mix must have this Task set up. I have looked at other ways – RemoteInstall looks very promising except you must turn off UAC in order for it to work. So I’m now resorting to these hacky workarounds.

EDIT: The same behavior occurs if I use vmrun.exe to start the task. Unless I am already logged into the machine through a remote session, it doesn’t work e.g.:

EDIT: The same behavior occurs if I use sysinternals ‘PsExec.exe’ to run program in the VM – it only works if I am already logged into an interactive session.

vmrun -T ws -gu myusername -gp myfakepassword runProgramInGuest D:\VMware-VMs\testvm-3\testvm-W7x86-3.vmx -activeWindow "C:\users\myusername\desktop\StartTask.bat"
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:14:44+00:00Added an answer on June 13, 2026 at 1:14 pm

    From the VMvare docs: “VIX_LOGIN_IN_GUEST_REQUIRE_INTERACTIVE_ENVIRONMENT should be used to ensure that the functions CaptureScreenImage, OpenUrlInGuest, and RunProgramInGuest work correctly.”

    This flag assumes that the VM is already running and you are logged in.

    http://www.vmware.com/support/developer/vix-api/vix16_reference/lang/com/functions/LoginInGuest.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am at a loss how best to approach for loops in JavaScript. Hopefully
I'm at a loss and hoping to find help here. What I'm trying to
I'm at a loss here. I have this class I've created that takes arguments
I am at a loss here of a best-practice to pass XML back and
I'm trying to use Adobe AIR 2's NativeProcess API to emulate the ApplicationUpdater but
I am wondering what strategies others use to avoid data loss when saving files
I am at a loss here so I'm reaching out to the collective knowledge
I'm afraid I'm at a loss here, I checked out some similar questions but
I'm at a loss, since I'm not a Tomcat person. I need to use
I'm at a loss as to what is happening here. I'm getting undesired spaces

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.