No announcement yet.

AutoLogin Registry

  • Filter
  • Time
  • Show
Clear All
new posts

  • AutoLogin Registry


    I wonder if anyone can help please. I have setup a number of machines (46) in a small Domain, what I want to do is setup the registry keys in Hkey_local_machine\software\microsoft\windowsNT\cu rrentversion\winlogon

    So that the computer can login according to its machine name (%COMPUTERNAME%)

    Corresponding usernames are all setup i.e. pc1 through to pc46 on the domain and I can enter pc1 into the DefaultUserName string and it works perfectly, however, when I enter %COMPUTERNAME% into the string the output is %COMPUTERNAME%, obviously.

    Is there anyway I can pass the variable %COMPUTERNAME% into the DefaultUserName string? Preferably without too much programming?

    Thanks in advance for any help offered.


  • #2
    Re: AutoLogin Registry

    Try this script:

    On Error Resume Next
    Dim oShell, oNetwork
    Dim sRegPath, sDomainName, sUserName, sPassword
    sDomainName = "DOMAIN"
    sPassword = "Password1"
    'Retrieve ComputerName:
    Set oNetwork = CreateObject("WScript.Network")
    sUserName = oNetwork.ComputerName
    Set oNetwork = Nothing
    'Write Registry Keys:
    Set oShell = Wscript.CreateObject("Wscript.Shell")
    sRegPath = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\"
    	'Enable AutoLogon:
    	oShell.RegWrite sRegPath & "AutoAdminLogon", 1, "REG_SZ"
    	'Set Domain:
    	oShell.RegWrite sRegPath & "DefaultDomainName", sDomainName, "REG_SZ"
    	'Set UserName:
    	oShell.RegWrite sRegPath & "DefaultUserName", sUserName, "REG_SZ"
    	'Set Password:
    	oShell.RegWrite sRegPath & "DefaultPassword", sPassword, "REG_SZ"
    Set oShell = Nothing
    Last edited by martin77; 13th September 2006, 13:45.


    • #3
      Re: AutoLogin Registry

      Thanks Martin77, I'll give it another go. I don't suppose there's another way to directly enter the %COMPUTERNAME% varibale into the DefaultUserName without having to resort to a script? Is it possible to create the registry value using another type of key, that can pull the %COMPUTERNAME% info directly from the machine?

      I'm only thinking this way, beacuse it cut's down on my time and I can easily create machine images that can be deployed by 'non IT users' in case of a fault. That way the registry stays the same in every build and it does'nt matter which machine name gets re-imaged - it will always logon as %COMPUTERNAME%

      I really need a beer right about now!


      • #4
        Re: AutoLogin Registry

        1 1 was a racehorse.
        2 2 was 1 2.
        1 1 1 1 race 1 day,
        2 2 1 1 2


        • #5
          Re: AutoLogin Registry

          Yeah enough! Onto the shorts!! Make mine a large Rum!


          • #6
            Re: AutoLogin Registry

            How about a batch file then?
            (you can put it in the RunOnce in the registry)

            SET DOMAIN="DomainNameHere"
            SET PASSWORD="YourPassword"
            Echo y| REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d "1"
            Echo y| REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultDomainName /t REG_SZ /d %DOMAIN%
            Echo y| REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d %COMPUTERNAME%
            Echo y| REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /t REG_SZ /d %PASSWORD%


            • #7
              Re: AutoLogin Registry

              Nice one!

              you star!