Resources for IT Professionals > Forums Home > Solution Accelerators Forums > Microsoft Deployment Toolkit > How to rename local administrator account when deploy Windows 7 image?

Answered How to rename local administrator account when deploy Windows 7 image?

  • Thursday, May 13, 2010 3:10 PM
     
     

    I am using MDT 2010 to deploy Windows 7 image. The image deployed fine and before I capture the image, I renamed local administrator account but the captured image reverse back to default administrator account?

    Thanks for any help!

    Ying

Answers

All Replies

  • Thursday, May 13, 2010 5:02 PM
     
     Proposed Answer

    When I want to rename an account with a script, i use wmic, which is built into Windows. For instance:

    wmic useraccount where name='Administrator' call rename name='MyAdminAcct'

    • Proposed As Answer by AdrianTP Monday, April 18, 2011 2:48 PM
    •  
  • Thursday, May 13, 2010 5:48 PM
     
     

    David,

    Thanks for reply. I can reanme the account but my problem is that I cann't seem to keep it in the captured image. While I can do this XP no problem?

    Thanks,

  • Thursday, May 13, 2010 8:29 PM
     
     

    As far as I know, MDT requires that the built-in account on the end-OS be named Administrator.

    The answer to this would be to start with your pre-image system, rename the built-in account back to Administrator, perform your Sysprep, then add an Administrator-renaming command during the MDT task sequence you use.

  • Thursday, May 13, 2010 11:43 PM
     
     

    I figured this may have something to do with UAC. I sure can do this for XP no problem!

    I guess I will just try deploy the image and add a MDT task sequence to rename the local admin account.

    Thanks again!

  • Friday, May 14, 2010 1:23 PM
     
     

    If you rename Administrator account in SetupComplete.cmd it shouldn't be any problem - that how I am doing.

    I have SetupComplete.cmd in source\$OEM$\$$\Setup\Script at Windows 7 installation folder at MDT server - all commands are being applied before first login of user.

    For sure you need to put new administrator name in Unattended.xml - x86_Microsoft-Windows-Shell-Setup_neutral > AutoLogon > Username.

  • Friday, May 14, 2010 9:07 PM
     
     Answered

    Thanks for the reply! I am not very familiar with SetupComplete.cmd. I created a MDT Task Sequence and run a PowerShell script. it worked!

    http://blogs.technet.com/mniehaus/archive/2009/07/10/mdt-2010-new-feature-16-powershell-support.aspx

    Here is what's in my script -

    $admin=[adsi]"WinNT://./Administrator,user"
    $admin.psbase.rename("whatever")

    So it's clear that we can't rename the administrator account then capture it.

    • Marked As Answer by Ying Li8 Friday, June 04, 2010 4:21 PM
    •  
  • Tuesday, May 18, 2010 7:44 AM
     
     

    Yes we can :)

    I am changing Administrator name in SetupComplete.cmd and before capture I am aplying local GPO with admin rename to the same name.

  • Friday, July 16, 2010 8:59 PM
     
     Proposed Answer

    It took some time, but I have finally discovered how to rename the Administrator account during Windows 7 sysprep

    In Windows SIM/unattend.xml

    *4 specialize PASS*
    x86_Microsoft-Windows-Deployment_neutral
    -RunSynchronous
    --RunSynchronousCommand
    ---Order: 1
    ---Path: net user YourAdminName /active:yes

    *7 oobeSystem PASS*
    x86_Microsoft-Windows-Shell-Setup_neutral
    -AutoLogon
    --Enabled: true
    --LogonCount: 5
    --Username: YourAdminName
    -UserAccounts
    --AdministratorPassword
    ---Value: (enter your administrator password)
    --LocalAccounts
    ---LocalAccount
    ----Description: Administrator
    ----Displayname: YourAdminName
    ----Group: Administrators
    ----Name: YourAdminName

    SETUPCOMPLETE.CMD
    wmic useraccount where name='Administrator' call rename name='YourAdminName'

     

    Drop the above files into the proper locations (unattend.xml into C:\WINDOWS\System32\sysprep  setupcomplete.cmd into C:\WINDOWS\Setup\Scripts)

    At the VERY end of customizing your image (doing so before hand could result in various errors, such as when trying to access network, etc)
    GPEDIT.MSC > Windows Settings > Security Settings > Local Policies > "Accounts: Administrator account status": Enabled
    GPEDIT.MSC > Windows Settings > Security Settings > Local Policies > "Accounts: Rename administrator account": YourAdminName

    Run from command prompt "sysprep /generalize /oobe /unattend:unattend.xml", shutdown, capture image, and upon booting the image you should automatically be logged in as the correctly named administrator account, the C:\Users\profile will be named correctly, and everything is 100% :)

     

    • Proposed As Answer by Matthew Z. _ Thursday, July 29, 2010 5:24 PM
    •  
  • Thursday, July 29, 2010 5:27 PM
     
     

    I have tested this and it work

     

    In the SETUPCOMPLETE.CMD you should include the quotes as you see below.

    SETUPCOMPLETE.CMD
    wmic useraccount where name="Administrator" call rename name="YourAdminName"

     

    Thanks for the help this really helped us out.