I want to change HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\winlogon and change the value of DefaultUserName. How I can do it?
Because this is not a policy setting in Group Policy management but a regular registry key, you would need to create a custom ADM file which will then allow you to change this key. Be warned, however, that this will only allow you to set this as a "preference" rather than a true policy. We have a lot of information about this phenomenon at GPanswers.com. Just note the setting can be overwritten by other processes, such as in the case you mention where this key is in fact written over at logon to hold the name of the last user who logged in.
If you are trying, specifically, to get the machine to log on automatically with a particular user account you would be better off using a third-party tool such as TweakUI.
If you are simply trying to hide the name of the last user who logged in you can use the policy setting at:
Computer ConfigurationWindows SettingsLocal PoliciesSecurity Options Interactive logon: Do not display last user name
This was first published in September 2006