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.