Vminit is an initialization tool that lets you configure networks, set hostnames, and run custom scripts on Elastic Compute Service (ECS) instances running Windows. If your custom image does not include Vminit, you must install it manually to ensure proper instance initialization. This topic shows you how to install Vminit in the virtual machine (VM) used to create the image.
Limitations
Vminit supports 32-bit and 64-bit versions of Windows 7, Windows Server 2008 R2, and later.
Install Vminit
This topic uses Vminit 2.0.1.2 as an example. For other versions, see Release notes.
Download and extract the Vminit installation package in the VM used to create the image.
Download URL: AliyunVminit.zip.
Install Vminit.
GUI installation
In the download directory, find and double-click
AliyunVminit_2.0.1.2_x86_64.exe.Follow the on-screen instructions to complete the installation.

The following window indicates a successful installation.

CLI installation
In Windows PowerShell, switch to the directory where you downloaded the package. For example,
C:\test.cd C:\testRun the following command to install Vminit:
.\AliyunVminit_2.0.1.2_x86_64.exe /SILENT /FORCENote/SILENT: Installs Vminit silently./FORCE: Overwrites an existing Vminit installation.
Verify the installation.
In Windows PowerShell, run the following command to check the version of Vminit:
(Get-Item C:\ProgramData\aliyun\vminit\vminit.exe).VersionInfo.ProductVersionThis output confirms that Vminit is installed.

Run the following command to retrieve the registry configuration information for Vminit:
Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\vminit"This output confirms that Vminit is installed.

After verification, Vminit is installed. You can now import the image to Alibaba Cloud.
(Optional) Configure Vminit
By default, Vminit automatically runs all its plug-ins during instance creation. If you create an instance from a custom image and want to prevent certain operations from running at startup, you can disable their corresponding plug-ins while you create the image.
Create a configuration file.
In the
C:\ProgramData\aliyun\vminitdirectory, create a file with the following properties:The file name must be named
customized_config.The file must not have a file name extension.
The content of the file must be in JSON format.
NoteProgramDatais a hidden directory. To view hidden items, enable the Show hidden files, folders, and drives option in your folder settings.Disable specific plug-ins.
The following example shows how to disable the plug-ins for automatic hostname configuration and data disk initialization.
Disable automatic instance hostname configuration and data disk initialization.
To prevent Alibaba Cloud from automatically configuring the instance hostname and initializing the data disk, disable the
Plugin_Main_ConfigHostnameandPlugin_Main_ConfigDiskplug-ins. Copy the following JSON content into thecustomized_configfile and save it.{ "disabledPlugins": ["Plugin_Main_ConfigHostname", "Plugin_Main_ConfigDisk"] }
If you need to re-enable a plug-in later, remove its entry from the customized_config file.
FAQ
Why does a Windows instance restart once during creation?
Cause: When you create a Windows instance, Alibaba Cloud assigns a default hostname even if you do not specify one. In Windows, changing a hostname requires a system restart to take effect. Therefore, the system restarts once during the creation process.
Solution: If you prefer to set the hostname yourself, disable the
Plugin_Main_ConfigHostnameplug-in. After you disable this plug-in, the system no longer automatically assigns a hostname.
References
For details on Vminit, see Vminit.
When you install Vminit, all its plug-ins are enabled by default. If you want to prevent certain operations from running automatically at startup, disable the corresponding plug-ins when you create the image. For instructions, see Disable specific plug-ins.
To ensure that ECS instances created from the image can recognize virtio devices and start correctly, you may also need to install the virtio driver after you install Vminit in the virtual machine for your Windows image.
For Linux images, cloud-init handles initialization. For more information, see Install cloud-init.