MDT - Start session after final reboot with renamed default admin account

Imanol Oiarzabal 30 Puntos de reputación
2023-11-08T15:35:45.5966667+00:00

Hi everyone,

i'm trying to start windows with renamed admin default account after MDT deployment finishes without writing down the new account.

I mean,

1.- As very last step before last reboot, i run a command line to rename the default administrator account mdt uses with wmic

2.- when the system reboots the account displayed in username textbox is the default account name ADMINISTRATOR instead of mine, renamed one.

I have to delete administrator and write down the "new" account name, for example, SysAdmin.

is there a way to start displaying SysAdmin in username textbox? so i dont have to delete and write every time i deploy a machine?

thks in advance,

Windows para empresas | Cliente de Windows para profesionales de TI | Experiencia del usuario | Otros
0 comentarios No hay comentarios
{count} votos

1 respuesta

Ordenar por: Muy útil
  1. Wesley Li-MSFT 4,576 Puntos de reputación Personal externo de Microsoft
    2023-11-09T01:50:24.2566667+00:00

    Hello

    Yes, you can achieve this by updating the MDT AutoLogin registry settings after renaming the local admin account. Here is a script that does exactly that:

    '//—————————————————————————-
    '// Global constant and variable declarations
    '//—————————————————————————-
    Option Explicit
    Dim iRetVal
    '//—————————————————————————-
    '// Main routine
    '//—————————————————————————-
    'On Error Resume Next
    iRetVal = ZTIProcess
    ProcessResults iRetVal
    'On Error Goto 0
    '//—————————————————————————
    '// Function: ZTIProcess ()
    '//—————————————————————————-
    Function ZTIProcess ()
        Dim colUserAccounts
        Dim objUser
        Dim oAccount
        Dim AdminAccount
        Dim strComputer
        Dim objNet
        Set objNet = Createobject ("WScript.Network")
        strComputer = UCASE (objNet.ComputerName)
        'Determine Local Administrator Account
        Set colUserAccounts = objWMI.ExecQuery ("Select * From Win32_UserAccount where LocalAccount = TRUE")
        For each oAccount in colUserAccounts
            If Left (oAccount.SID, 6) = "S-1-5-" and Right (oAccount.SID, 4) = "-500" Then
                oLogging.CreateEntry "Renaming regional Administrator account to Admin" , LogTypeInfo
                AdminAccount=oAccount.Name
                oAccount.Rename "Admin"
                oLogging.CreateEntry "Updating MDT autoLogon key with renamed Administrator info (Admin)" , LogTypeInfo
                oShell.RegWrite "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\DefaultUserName" , "Admin" , "REG_SZ"
            End If
        Next
        iRetVal = Success
        ZTIProcess = iRetval
    End Function
    

    This script renames the local admin account (in any language) and updates the MDT AutoLogin registry settings. You need to replace "Admin" with your desired username on the two lines shown below:

    oAccount.Rename "Admin"
    oShell.RegWrite "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\DefaultUserName" , "Admin" , "REG_SZ"
    

    After running this script, the system should display your renamed account in the username textbox after reboot.


Su respuesta

Las respuestas se pueden marcar como respuestas aceptadas por el autor de la pregunta, lo que ayuda a los usuarios a conocer la respuesta que resolvió el problema del autor.