VMware Cloud Community
Zimmerkm
Contributor
Contributor

Local Administrator Rename when Provisioning from Template

I need to start rolling out Windows Server 2022. I have created a 2022 template, then provisioned a server. When I logged in, I found that the local administrator account was reset to the default Administrator. This is important because after the initial boot, we initiate scripting to join the machine to the domain, install default S/W, etc. as the renamed administrator account.

I've tried:

1. Create template by cloning a server with the Administrator account already renamed and local policy set to rename the Administrator account

2. Create template - 2022 OS with standard Administrator, ran Sysprep in audit mode, renamed Administrator to new name, edited local policy to rename Administrator account, ran Sysprep, converted to template

3. Create template - 2022 OS with standard Administrator, ran Sysprep in audit mode, renamed Administrator to new name, edited local policy to rename Administrator account, ran Sysprep, cloned to template

All of these scenarios resulted in the default Administrator name upon initial boot. Can anyone give me a different idea to try?

 

0 Kudos
2 Replies
Shen88
Hot Shot
Hot Shot

@Zimmerkm,

Please use VM Customization Specifications available in the vSphere to apply a specification to the guest operating system during virtual machine cloning or deployment stage. Now, in this custom spec under (Optional) On the Run Once page, specify below command to run the first time a user logs in to the guest operating system and click Next.

cmd /c wmic useraccount where name='Administrator' rename LocalAdmin

 

Also, refer below documentation if you're new to using custom specs.

https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.vm_admin.doc/GUID-EB5F090E-723C-447...

 

If you think your queries have been answered, Mark this response as "Correct" or "Helpful" and consider giving kudos to appreciate!

Regards,
Shen
Zimmerkm
Contributor
Contributor

@Shen88 Sorry for taking so long to respond and thank you for your suggestion. I'm already using custom policies to install S/W, join domain, etc. so I tried adding this command as the first policy, followed by a logout (When that failed, I tried rebooting), then run the original script. I was not able to get it to work.

I opened a ticket with VMware who provided a fix. On the template machine, I had to create a Scripts folder under C:\Windows\Setup, then create a SetupComplete.cmd file containing "wmic useraccount where name="Administrator" call rename name="<Custom Admin Name>"". See https://communities.vmware.com/t5/Windows-Discussions/how-to-keep-Windows-built-in-administrator-nam...

Thank you for taking the time to respond to my question!