@echo off
Rem Following commands will set registry values required for Aumatic Login
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\winlogon" /t REG_SZ /v AutoAdminLogon /d 1 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\winlogon" /t REG_SZ /v DefaultUserName /d
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\winlogon" /t REG_SZ /v DefaultPassword /d
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\winlogon" /t REG_SZ /v DefaultDomainName /d TEST.LOCAL /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\winlogon" /t REG_DWORD /v ForceAutoLogon /d 1 /f
Rem Following commands will delete Logon Banner related Values.
reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\winlogon" /v LegalNoticeCaption /f
reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\winlogon" /v LegalNoticeText /f
This will enable autologon feature on your server. But will be applicable at next reboot. I tried using it at the startup but it requires one more restart. There is one more reason for using it at shutdown which will be explained in next step. Additionally I converted this bat file into exe using some utility (there are many utilities available on internet ,but make sure you use the reliable and recommended one) so that it can not be viewed/editted using notepad (text editor ) as there is a password mentioned in it.
Now configure exe thus created as a shutdown script. This will configure registry settings required to enable autoLogon feature.
2. Create a script using following commands and configure it as a startup script. This time no bat to exe conversion is required.
@echo off
Rem Following commands will delete registry values required for Aumatic Login
reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\winlogon" /v AutoAdminLogon /f reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\winlogon" /v DefaultUserName /f
reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\winlogon" /v DefaultPassword /f
reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\winlogon" /v DefaultDomainName /f
reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\winlogon" /v ForceAutoLogon /f
REM This will not show logged in user information while machine is locked..
reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System /v dontdisplaylockeduserid /t REG_DWORD /d 3 /f
Note:- As I said earlier, reason behind using this script at startup is to destroy settings defined in shutdown script once the purpose is over. Settings defined in step 1 will be read at next reboot and will be applicable as 'Startup Script' execution will be done after reading registry values. This will ensure that password is not available in registry and still AutoLogon is enabled.
Refer http://support.microsoft.com/kb/324737 for more details about automatic logon.
Rerer http://support.microsoft.com/default.aspx/kb/837022?p=1 for more details about HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System/dontdisplaylockeduserid
3. Create a logon script for user specified in AutoLogon settings with following commands.
@echo off...
REM ...........following command will Lock the workstation..Use same syntax..........
%windir%\system32\rundll32.exe user32.dll,LockWorkStation
Rem .............following command will launch the application.....
The first command will lock the machine immediately after user logs in and second command will launch the application while user is logged in..
I tried to auto logon and launch some built in windows applications like notepad, calc and it worked. Depeding upon how the application is designed you may need to specify more than one command..
This is how it works..
1. Machine configures AutoLogon during shutdown.
2. Machine reads AutoLOgon settings at next reboot.
3. Deletes AutoLogon values from registry.
4. Logs in using settings read at step 2
5. User login script gets executed ...Locks the machine and launches the application.
ไม่มีความคิดเห็น:
แสดงความคิดเห็น