Self-booting and auto-shutdown of VMware virtual machines in Windows environment-command-line operation

Source: Internet
Author: User

, set the boot-free login system

1. Press the Windows + R key combination to enter " Netplwiz", click Enter. 2. Remove the tick that requires password login. 3. If you need a password, enter the password and click Confirm. Second, edit VMware startup and suspend scripts to start the virtual machine script using the Vmrun tool as follows:

"C:\Program Files (x86) \vmware\vmware Workstation\vmrun" Start "D:\VMWare\Mint 64-bit-dns&ntp\mint 64-bit.vmx" Nogui

Use the Vmrun tool to suspend the virtual machine script as follows:

"C:\Program Files (x86) \vmware\vmware Workstation\vmrun" suspend "D:\VMWare\Mint 64-bit-dns&ntp\mint 64-bit.vmx"

Third, set the boot automatically start 1. Enter "Shell:startup" to open the user Startup folder and place the above startup script in this folder. Four, set off automatically suspend 1. Execute "gpedit.msc" and open the "Local Computer Policy"--"Computer Configuration"-"Windows Settings"-"Scripts" and click "Shut down" in the right column of the window. 2. Write the shutdown or suspend command that you want to execute into a. bat batch program, and add it.

---------------------------------------------------------------------------

1. System Boot from VMware virtual machine

On this feature, there are many articles on the web about its solution, there are two main: "Use the tool to load the virtual machine as Windows system Services" and "Custom scheduled task items", I recommend the use of the following one, that is, "Custom scheduled Task item", The main reasons are: Using this scheme can realize the automatic shutdown of virtual machine or automatic suspend, and using Windows system services, we can test the successful virtual machine automatic shutdown and automatic suspension.

It is important to note that the commands in the scheduled task item are not vmware-x that are described in many articles ..., but instead use Vmrun, the full command behavior:

%path%\vmrun-t WS-Start "virtual machine vmx configuration file full path name"

The Vmrun program is in the same directory as VMware. The same reason for using Vmrun is to enable automatic shutdown and automatic suspension of virtual machines.

As for the other inputs of the custom scheduled task, it is not verbose here.

2, the system shuts down automatically, hangs the VMware virtual machine

After you start a virtual machine using Vmrun, you can use the Vmrun List command to view the currently running virtual machine.

The command to shut down the virtual machine is: Vmrun stop virtual machine VMX profile full path name soft

Note that at the end of the command line, the soft must not be missed, which is equivalent to pressing windows and its power key, which causes the virtual machine to perform the shutdown program specified by the operating system. It can also be seen that this shutdown method only supports Windows, Linux and other virtual machines.

For virtual machine operating systems that do not recognize soft shutdown instructions, it is recommended that the virtual machine be suspended at the host computer, with the following command:

Vmrun suspend "virtual machine vmx configuration file full path name"

The above just said how to shut down and suspend the virtual machine, then how to automatically perform the virtual machine shutdown or suspend when the host machine? The Group Policy for Windows is needed here.

Execute "gpedit.msc" and open the "Local Computer Policy"--"Computer Configuration"-"Windows Settings"-"Scripts", click "Shut down" in the right column of the window, and write the shutdown or suspend commands that need to be executed into a. bat batch program, Add to this.

It is necessary to note that the system shutdown scripts are executed when the system logs off all users and before the system shuts down, so these commands will not work for virtual machines that are started from the Windows logon user interface, because when the user logs off, The Windows system has automatically stopped the user's virtual machine process.

3, for the Win7 environment in the shutdown script problem

In a Win7 environment, Win7 will force all non-system processes to terminate before the shutdown script is executed, and the shutdown script will not function. It is possible to modify the following settings:

Execute "gpedit.msc", step through the local Computer policy, computer Configuration, Administrative Templates, and system-shutdown options, turn off the automatic termination of applications that will block or cancel the shutdown policy. The Windows shutdown script that we set up to shut down the virtual machine takes effect.

---restore content ends---

Self-booting and auto-shutdown of VMware virtual machines in Windows environment-command-line operation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.