VMware vSphere

 View Only
  • 1.  Local Administrator Rename when Provisioning from Template

    Posted Mar 22, 2024 12:49 PM

    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?

     



  • 2.  RE: Local Administrator Rename when Provisioning from Template

    Posted Mar 23, 2024 08:29 PM

    ,

    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-4470-B640-50B35D1EC016.html

     



  • 3.  RE: Local Administrator Rename when Provisioning from Template

    Posted Apr 12, 2024 07:52 PM

     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-name-from-always/td-p/2890812

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