Due to the need to perform software testing under different systems, virtual machines of various systems are installed on the Windows test server. Every time the Windows server restarts, it is always connected to the remote virtual machine, but there are still some problems. Many posts I didn't mention it, but I finally got it. To avoid forgetting and making detours in the future, I hereby record it as follows.
Step 1: Install Window Server 2003 Resource Kit Tools Microsoft Official Download
To use the instsrv.exe and srvany.exe tools in this toolkit. (where intsrv.exe is a tool for creating windows services, ; srvany.exe is a tool for running exe executable files as system services). In windows server 2008 It prompts for compatibility issues during installation, regardless of whether it continues to install. (Assume the installation is in the C:\tools directory).
Step 2: Install VMware-workstation-full-12.1.1-3770994, Vmware official download
When installing VMware workstation, be sure to select "Run as administrator" , otherwise there will be a problem of not having the right to start the virtual machine later.
Step 3: Add a virtual machine, represented by CentOS6 here, and install it to D:\VMS\CentOS6
Step 4: Open the CMD command line and add a Windows service, here is VMware_AutoStart as an example.
C:\tools\instsrv.exe VMware_AutoStart C:\tools\srvany.exe
Step 5: Modify the registry and set specific instructions to start the virtual machine to the VMware_AutoStart service
Run regedit to open the registry,
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\VMware_AutoStart, (where VMware_AutoStart is the given service name, if you name it differently, please find the corresponding item).
Create a new item Parameters under the vmautorun item
Open the new item Parameters, create a new string value in the Parameters item, the value name is Application,
The value data is vmrun -T ws start "D:\VMS\CentOS6\CentOS6.vmx" nogui
(The vmrun.exe file is in the VMWare installation directory. For convenience, you need to set this directory to the PATH environment variable. You can also use vmware -x "d:\VMs\CentOS\centos.vmx" for numerical data here)
(You can also write directly: D:\VMware\ VMware Workstation\vmrun.exe -T ws start " D:\VMS\CentOS6\CentOS6.vmx " nogui )
Step 6: Add dependent services to the service
The most critical step is here, (many posts do not have this step, it is the key to success), setting the service's dependent services
Open the VMware_AutoStart item, create a new multi-string value item, name it DependOnService , and the value is VMwareHostd
Step 7 : Run services.msc to open the system service list, select the VMware_AutoStart service, open the service properties, select the local system account on the login page , and tick Allow the service to interact with the desktop .
Step 8: Restart the server to test.