Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is it possible to run VMware player as a Windows Service so that a user does not have to be logged in to have the player running?

share|improve this question
add comment

3 Answers

up vote 14 down vote accepted

Vmware Server is the correct tool for running a VM in the background, not Vmware Player.

share|improve this answer
1  
(and is also free) –  Chris_K Oct 2 '09 at 19:40
2  
Not strictly true. People all over the net are running VMWare Player as a service. –  JamesBarnett Nov 27 '11 at 9:12
3  
@JamesBarnett people do lots of things that aren't "ideal" - go for a drive and watch how others behave on the roads if you don't believe me. The fact that you can 'bodge' VMWare player into running as a service doesn't alter the fact that VMWare server is the intended tool for that job. –  RobM Nov 27 '11 at 10:10
1  
Maybe depends on the use case. If you want to run a VM unattended because you want a cheap VMWare Server then I agree with you. However the statement "the correct tool for running a VM in the background" is overly broad. In my case, I wanted to run linux side-by-side with Windows using Unity mode and not have to worry with seeing the VMWare Player UI. Also Windows is overly found closely binding GUIs with background processes. A central part of computer history is being able to hack a something to do what you want. The tool isn't wrong, you just need to know it's limitations. –  JamesBarnett Nov 27 '11 at 10:21
6  
vmware server is deprecated and has a low "vm hw version" –  Sirber Jan 17 '12 at 15:27
show 3 more comments

Sorry for the late responce with this. I was trying to figure this out today. I came across this answer, figured I let SF know.

You can actually ...

  • Add this to your VMX config file to set VMWare Player not show the UI:

    msg.noOk = "TRUE"

  • Get instsrv.exe from a Windows Server Resource Kit to create your own service

  • On Startup have a batch file call the service you just made

Step-by-step instructions can be found here:

http://research.stowers-institute.org/dct/docs/admin/VMwarePlayerService.htm

share|improve this answer
add comment

I know this is an old question, but I searched all over the internet for a solution to this and I couldn't find anything quite as comprehensive as what I'd like to share.

Yes, it's possible to use vmware player as a service for Linux (there's a separate answer for Windows); it's easy and there's no reason I can think of not to do it. It's especially great for hosting a headless server from a headless server.

The other VMware-oriented choice, VMware Server, is deprecated and the only other $0 choice I know of is VirtualBox. If you like that better than VMWare Player, more power to you, but I know VMWare Player and I don't see a reason not to use a well-supported path to get what I want.

Presumably you'll want it to run under a non-root account and start up and shut down at the standard service startup/shutdown times. If that's the case, then here's how to configure it:

  • Get the daemon package (usually not installed by default):

    apt-get install daemon
    
  • Download VMware Player and VMware VIX from vmware.com and install them to get the VM engine and VIX's vmrun (command-line control of vm execution) binary.

  • Add the service to the startup by creating /etc/init.d/<vm_server_name>. It could look something like this:

    #! /bin/bash
    ### BEGIN INIT INFO
    # Provides:          vm_server_name
    # Required-Start:    $named $remote_fs $syslog
    # Required-Stop:     $named $remote_fs $syslog
    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6
    # Short-Description: My Server VM
    # Description:       Virtual Machine instance of My Server
    ### END INIT INFO
    
    PATH=/sbin:/usr/sbin:/bin:/usr/bin
    VM="/path/to/vmx_file.vmx"
    USER_TO_RUN_UNDER="username"
    
    if [[ "$USER" == "$USER_TO_RUN_UNDER" ]]; then
      USER_FLAG=""
    else
      USER_FLAG="--user=$USER_TO_RUN_UNDER"
    fi
    
    case "$1" in
        start)
            daemon $USER_FLAG -- vmrun -T player start "$VM" nogui &>/dev/null &
            ;;
        stop)
            vmrun -T player suspend "$VM" &>/dev/null
            while [[ "$(vmrun -T player list | grep -o "$VM")" == "$VM" ]]; do
              sleep 1
            done
            ;;
        *)
            echo "Usage: $0 start|stop" >&2
            exit 3
            ;;
    esac
    
  • Make the script runnable:

    chmod a+x /etc/init.d/vm_server_name
    
  • Add the script to the standard linux service startup/shutdown runlevels. The numbers ensure that it is one of the last things started and the first to be shut down:

    update-rc.d vm_server_name defaults 99 01
    

Notes:

  • You'll probably need to 'sudo' all the commands as you're modifying root-owned files.
  • I put a loop in so that on shutdown the script doesn't return to the OS until it has completely suspended the guest OS. I don't know if that's needed or not, but it seemed like a good idea. It will definitely slow down shutdown of the host OS, but it is worth it in my opinion.
  • If you need to interact with the local GUI of the guest OS, suspend the server by running /etc/init.d/vm_server_name stop and then start it locally using the VMware player GUI. After finishing, suspend it and run /etc/init.d/vm_server_name start to start the headless instance again.
share|improve this answer
    
If Vmware player, and Virtual box are the only thing you came up with on Linux, then you aren't searching very hard. KVM and Xen are the preferred tools these days. –  Zoredache Nov 6 '12 at 0:17
1  
A good answer for Linux users, but the question was specifically asking about running VMWare Player as a Windows Service -- Perhaps you should ask and answer a separate question about doing this on Linux :-) –  voretaq7 Nov 6 '12 at 4:26
    
Thanks for the pointers to other solutions. Try searching for 'vm as a service' in google and you'll see what I saw. I think what you are really saying is that you believe hypervisors are the new hotness. I think there are valid reasons for hobbyists to choose a linux host with other vm's as services, but for scalability I'm sure you're correct. –  David Gladfelter Nov 6 '12 at 6:39
    
Oops, I didn't see the word 'Windows' in the question. –  David Gladfelter Nov 6 '12 at 6:40
    
hmm, on second thought I think windows wasn't mentioned in the question when I answered it. Could be wrong... –  David Gladfelter Nov 6 '12 at 6:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.