Closed platinum55 closed 4 years ago
Hello, The password defined under the [vm] section is used for AutoLogon so that we can perform actions on the VM. The "net user Administrator" will not work, because the Administrator account is being reset by sysprep. During the image generation you can either create another user with a predefined password and administrative rights, or you can specify the user and the password in the unattend.xml used for sysprep (you will find it in the Cloudbase-Init install directory, in the conf folder).
Another method would be to use the "net user Administrator" method inside a script placed in Program Files\Cloudbase Solutions\Cloudbase-Init\LocalScripts directory. Those scripts will be run on first boot. Please check the File Execution paragraph in this article to instruct Cloudbase-init what to do after the script executions is done: https://cloudbase-init.readthedocs.io/en/latest/tutorial.html#file-execution .
Depending on the environment you are using the image, the password can also be set by Cloudbase-init from the cloud metadata (in Openstack for example), and retrieved later using the nova get-password.
Let us know if this helps or if you face any other issues.
thanks alot for your info, got it working via the LocalScripts Directory! :+1:
Closing this issue, as the problem was solved.
Hello,
with windows 2019 server the admin password defined in config.ini was not set in the image, it asks for new password when first booting on the client machine - any idea how to fix this?
I tried to set "net user Administrator" in "RunAfterSysprep.ps1" CustomResources script, with no effect. The build process didnt show any error
thanks for help beforehand :)