Question

Locked

Automatic Logon and delete registry entry afterwards

By steve ·
I have written a script that enables me to create a scheduled task and restart a server at a suitable time for the business. However, i also need to be able to logon to the server and then allow it to lock it. Locking it can occur by default timeout and this is fine.
I have read articles about adjusting the registry for automatic logon but, i do not want this to happen for anyone at anytime. Therefore, i need to be able to run the automatic logon from my script just once. I do not want someone to be able to restart the server for it to be able to log them straight in. I have been informed by a colleague that they have heard of someone doing this where you can set a default number of times it will allow this to logon and counts down. So my view is that if i can somehow set it to 1 then, it will logon but, not allow it again, until my scheduled script runs again. Are you following me? Any help would be great as i can find nothing on this so far.

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Solution

by steve In reply to Automatic Logon and delet ...

Created the following commandline script which solved my problem. Process is to create this script and then set a scheduled task to run it whenever it is required. (Needs to run as Admin)
Have it running on SBS 2003 but, tried and tested on XP and W7.

This particular version, restarts the machine, logs on and then locks the terminal.

REM *** Configure Variables ***
SET KEY="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
SET KEY2=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce


REM *** Set the number of Logins to happen ***
REG ADD %KEY% /v AutoLogonCount /t REG_DWORD /d 1 /f

REM *** Set Login Details ***
REG ADD %KEY% /v DefaultUserName /t REG_SZ /d RT-ADM /f
REG ADD %KEY% /v DefaultPassword /t REG_SZ /d Passw0rd /f
REG ADD %KEY% /v AutoAdminLogon /t REG_SZ /d 1 /f
REG ADD %KEY% /v DefaultDomainName /t REG_SZ /d strobe-it /f

REM *** Setting Server / PC to Lock once logged in ***
REG ADD %KEY2% /v Lock /t REG_SZ /d "%windir%\System32\rundll32.exe user32.dll,LockWorkStation" /f

Many thanks

Steve Welsh
Strobe IT

Back to Networks Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums