To ensure that you can use the user data injection function to inject initial custom information (such as the login password) into ECSs created from a private image, install Cloudbase-Init on the ECS that is used to create the image.
Cloudbase-Init is open-source software. If the installed version has security vulnerabilities, you are advised to upgrade it to the latest version.
Download the Cloudbase-Init installation package of the appropriate version based on the OS architecture from the Cloudbase-Init official website (https://www.cloudbase.it/cloud-init-for-windows-instances/).
To obtain the stable version, visit the following paths:
The version number shown in the figure is for reference only.
Figure 1 Configuring parameters

Figure 2 Completing the Cloudbase-Init installation

The version number shown in the figure is for reference only.
If you are using NetBIOS in your network, the hostname cannot exceed 15 characters because NetBIOS has a 15 character limit.
plugins=cloudbaseinit.plugins.common.localscripts.LocalScriptsPlugin,cloudbaseinit.plugins.common.mtu.MTUPlugin,cloudbaseinit.plugins.windows.createuser.CreateUserPlugin,cloudbaseinit.plugins.common.setuserpassword.SetUserPasswordPlugin,cloudbaseinit.plugins.common.sshpublickeys.SetUserSSHPublicKeysPlugin,cloudbaseinit.plugins.common.sethostname.SetHostNamePlugin,cloudbaseinit.plugins.windows.extendvolumes.ExtendVolumesPlugin,cloudbaseinit.plugins.common.userdata.UserDataPlugin,cloudbaseinit.plugins.windows.licensing.WindowsLicensingPlugin
Plugin functions:
If you need to change the hostname of ECSs after they are created from this image, and services on the ECSs are sensitive to hostname changes, you are not advised to configure the SetHostNamePlugin here.
plugins=cloudbaseinit.plugins.windows.winrmlistener.ConfigWinRMListenerPlugin,cloudbaseinit.plugins.windows.winrmcertificateauth.ConfigWinRMCertificateAuthPlugin
Plugin functions:
The WinRM plug-ins use weak cryptographic algorithm, which may cause security risks. So, you are advised not to load these plug-ins.
retry_count=40retry_count_interval=5
[openstack]add_metadata_private_ip_route=False
Change the value of user_password_length to customize the password length.
first_logon_behaviour=no
real_time_clock_utc=true
The registry entry RealTimeIsUniversal=1 allows the system to synchronize time from BIOS. If real_time_clock_utc=true is not added, Cloudbase-Init will be set RealTimeIsUniversal back to 0, causing the system to not synchronize time from BIOS after a restart.
In the Windows command line, run the following command to release the current DHCP address:
ipconfig /release
This operation will interrupt network connection and adversely affect ECS use. The network will automatically recover after the ECSs are started again.
Windows has three types of SAN policies: OnlineAll, OfflineShared, and OfflineInternal.
Type | Description |
|---|---|
OnlineAll | All newly detected disks are automatically brought online. |
OfflineShared | All disks on sharable buses, such as iSCSI and FC, are left offline by default, while disks on non-sharable buses are kept online. |
OfflineInternal | All newly detected disks are left offline. |
diskpart
san
san policy=onlineall


