Why install a Virtual PC VM as a service?
Here's a scenario where you install the virtual PC on the Windows XP host and then install Windows Server 2003 in the virtual machine
(and promoted to domain control), now want the host to be able to log on to the domain of the virtual machine, what to do?
This seems to be a dilemma: if you want the host computer to log on to the domain of the virtual machine, you must start the virtual machine before the host is logged on;
To start a virtual machine, you must first log on to the host.
Now you can solve this problem by simply installing the virtual machine as a system service--you know that the service can run before the user logs on and
Can remain running after the user logs off.
Preparation Tools
For Windows XP Pro, you need to prepare the following two command tools:
(1) sc.exe:Windows XP from the command tool, the role is similar to the Services.msc management unit, belongs to the Service Control program (SCP).
In this article, we will use the Sc.exe command tool to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
The Virtual PC virtual machine is added below so that the Service Control Manager (SCM) can control the VM service.
(2) Srvany.exe:Windows Server 2003 Resource Kit Tools can be downloaded to the following Microsoft Official website:
http://www.microsoft.com/downloads/details.aspx displaylang=en&familyid= 9d467a69-57ff-4ae7-96ee-b18c4790cffd
Because the VPC virtual machine itself does not have the ability to interact with the Service Control Manager (SCM), it must use Srvany.exe instead of the SCM
for communication. Here, the VPC virtual machine can be viewed as a service initiated by the Srvany process.
Operation Steps
To facilitate the description, this assumes that the virtual PC's installation directory is "C:\Program Files\Microsoft Virtual Pc\virtual PC.exe",
You need to install the virtual machine vpc_dc as a service, and the Vpcdc,srvany.exe path for the service name is "C:\Program files\windows Resource kits\tools\srvany.exe".
(1) Open a Command Prompt window.
(2) Run the following command:
SC Create VPCDC type= interact type= own start= auto binpath= "C:\Program files\
Windows Resource kits\tools\srvany.exe "obj= LocalSystem displayname=" VPC DC Service "
Note double quotes with half-width characters!
The "type= interact" indicates that the service has a GUI interface on the desktop and can receive user interaction, which requires that the account identity of the service be LocalSystem (obj= LocalSystem); "Type= Own" Indicates that the process can be exclusive to each virtual machine service.
(3) Next open Registry Editor, you can see the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
There is a new VPCDC subkey that goes under the Parameters subkey, creates a new string key value application in the details pane on the right, and sets its numeric data to the following:
"C:\Program Files\Microsoft Virtual pc\virtual PC.exe"-pc vpc_dc-singlepc-launch
After the setup is complete, every time you start the host, you will automatically start the virtual machine vpc_dc, so that we can log into the domain of the virtual machine!