Each VM is automatically started when the virtual server is started.

Source: Internet
Author: User

Edit a VBScript file:

On   Error   Resume   Next

Set Virtualserver =   Createobject ( " Virtualserver. Application " )
Set Vmcollection = Virtualserver. virtualmachines
For   Each VM in vmcollection
Wscript. Echo " ==================================== "
Wscript. Echo " Name: "   & VM. Name
Wscript. Echo " Notes: "   & VM. Notes
Wscript. Echo
Wscript. Echo " Configuration file: "   & VM. File
Wscript. Echo
Wscript. Echo " Memory: "   & VM. Memory &   " M "
Wscript. Echo
Wscript. Echo " State: "   & VM. State
If VM. State = 1   Or VM. State = 2   Then   ' Off and saved
Wscript. Echo " Auto startup "
VM. startup
Wscript. Sleep wscript. Arguments ( 0 ) &   " 000 "
Wscript. Echo " New state: "   & VM. State
End   If
Wscript. Echo " ==================================== "
Next

Enable scripts attached to this server in the server properties of Virtual Server

Enter the following in command-line action when virtual server starts:
Cscript autostart. vbs 15

This 15 is the delay in seconds for each VM to start. If there is no delay, n vm instances will be started at the same time, causing a huge burden on the host.

In addition, in the general properties configuration of each Vm, select run virtual machine under the following User Account: and specify a user account name and password that can be logged on locally, we recommend that you use an account with the minimum permissions. Generally, you can read, write, and execute VM definitions and Virtual Disk Files. (For detailed permission requirements, see the virtual server administrator's Guide ), if this account is not specified, the script cannot be run.
Although we can set the automatic start and start delay in this place, we need to check the existing settings every time we increase or decrease the virtual machine to determine the time delay of the wrong start, which is troublesome, with this script, you can implement more complex logic by making some modifications once and for all.

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.