MDT not setting DefaultUserName

Oren, Steven J - (orens) 0 Reputation points
2023-04-13T22:17:50.1733333+00:00

We have a bunch of laptops we normally set the registries entries in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\Current Version\Winlogon (DefaultUserName, DefaultPassword), I've tried using PowerShell and running a command in a TS in MDT. So far it only adds the Name, but it leaves the data blank. If I delete the entries, it adds everything back but the data, if I try and add some fake key and data it works fine. If I run the PS or VBS manually from the admin terminal prmpt it works fine. Any suggestions?

$username = "laptop"

$password = "test"

New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name AutoAdminLogon -Value 1 -Force

New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name DefaultUserName -Value $username -Force

New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name DefaultPassword -Value $password -Force

New-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name AutoLogonCount -Value 9999 -Force

Windows for business Windows Client for IT Pros Devices and deployment Set up, install, or upgrade
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. XinGuo-MSFT 22,226 Reputation points
    2023-04-14T07:38:43.5066667+00:00

    Hi,

    Please try to temporarily disable UAC.

    Run Command Line
    Name: Disable UAC temporarily
    Command line: reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f

    Here are some good tips for your reference:

    Running the MDT Task Sequence as a Different User

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.