Closed Kuanlin-Chen closed 4 years ago
I tried to comment the block of UserAccounts template, it finally worked, I can only see one Administrator
account as I expected.
<!--<xsl:template match='u:unattend/u:settings/u:component[@name="Microsoft-Windows-Shell-Setup"]/u:UserAccounts/u:AdministratorPassword|u:unattend/u:settings/u:component[@name="Microsoft-Windows-Shell-Setup"]/u:AutoLogon/u:Password'>
......
......
<xsl:element name="LocalAccounts" namespace="{namespace-uri()}">
<xsl:element name="LocalAccount" namespace="{namespace-uri()}">
<xsl:attribute name="wcm:action">add</xsl:attribute>
<xsl:element name="Description" namespace="{namespace-uri()}">Admin user</xsl:element>
<xsl:element name="DisplayName" namespace="{namespace-uri()}">Administrator</xsl:element>
<xsl:element name="Group" namespace="{namespace-uri()}">Administrators</xsl:element>
<xsl:element name="Name" namespace="{namespace-uri()}">Admin</xsl:element>
......
</xsl:template>-->
Another strange situation, I found that something will trigger Logon.ps1
running when the instance starting or user login, which service do that? I have no idea.
@Kuanlin-Chen ,
This tool to create the image works like this:
You have these 3 stages in a visual form described in the readme: https://github.com/cloudbase/windows-openstack-imaging-tools#workflow-of-windows-imaging-tools
You have here a complete definition of all the configuration options applicable for all these 3 stages: https://github.com/cloudbase/windows-openstack-imaging-tools/blob/master/Config.psm1#L23
You are REQUIRED to use New-WindowsOnlineImage to run the above 3 stages.
If you run New-WindowsCloudImage, only the first stage will run and you are REQUIRED to move the image to your target cloud, start an instance there, wait for it to stop, then snapshot it and use the snapshot as the final image.
Getting back to your actual issues, you are not supposed to change any xml code in the tool, as you can specify custom cloudbase-init configuration files with the desired content: https://github.com/cloudbase/windows-openstack-imaging-tools/blob/master/Config.psm1#L146 https://github.com/cloudbase/windows-openstack-imaging-tools/blob/master/Config.psm1#L148
Please take a look at the docs for a better understanding of how all works: https://github.com/cloudbase/windows-openstack-imaging-tools/tree/master/docs
Thanks for the explanation, it really helps me a lot. Would you mind if I ask one more question?
As you said "all the scripts are removed and the Logon.ps1 script is removed from running at the next boot."
=> Do you mean the Logon.ps1
will not be removed from the image until the next boot? Why? And who triggers the script?
Logon.ps1 is configured as an autologon script, and it is removed by itself just before it triggers the shutdown.
According to this https://github.com/cloudbase/cloudbase-init/issues/24
I tried to modify the file
Unattend.xslt
, I changed itsDisplayName
andName
from Admin to Administrator, here is the code:The name of
Admin
finally changed, but the instance created from this image has twoAdministrator
accounts.BTW, I can't understand when this file
Unattend.xslt
be applied in the image? Any idea is appreciated.