Why I need this:
I have Pen Drive full of batch scrips and other diagnostic tools. I have 75 stand-alone (Not Networked) PCs 'mostly with Win-XP-Pro SP-2, in 2 Labs. I often need to login each PC with admin account to configure or diagnose something.
So when i start a PC, each time i have to manually select the user name from log-in screen and also type its password.
Now i want to Login to Admin Acc. Automatically (programmatically) if my pen drive is connected to the PC.
What i Know:
I know it is possible to run Scripts (Batch Files) before user login in XP/Win7. I wrote a batch file and saved to local PC. I configured it in group policy to run it on system startup (GPO Location: Computer Configuration\Windows Settings\Scripts (Startup/Shutdown)\Sartup). This batch file successfully detecting 'if the pen drive is connected or not.
I have another batch file (currently blank) stored on Pen Drive.
The 1st batch file searches all drives from C to Z for 2nd (login.bat) batch file using a loop, if the file is present it assumes pen drive is present and further calls the 2nd (login.bat) batch file to proceed.
What i don't Know:
Now I don't know what should be the code of login.bat file or i don't know 'how to login pragmatically.
What are other alternatives in mind:
It is not necessary to use a batch file only.
I can also consider 'if you have any other option for auto login like using VB Script
or any other 3rd part executable',
Edit:
According to this question Set user for auto logon on windows via batch script I can create a script to modify registry entries and allow auto log on. Even though this works, you have to reboot your PC for the changes to be applied. Which is something I want to avoid. It takes more time to run the script and reboot than just logging in personally.
I would like to be able to log on automatically, on demand. This means that once I connect my Pen Drive, the script should be able to log me in, in the admin account without rebooting the PC.
I read on the web it can be achieved by creating a GINA dll file, but I have no experience on that field. Any ideas how this can be implemented?
Best Answer
It is possible to login programmatically to Windows, but not with a simple batch file. Instead you need to build a DLL using C++ (or maybe C# - but it's not recommended). In Windows XP (and before), this facility is called GINA.
(Starting from Vista you need to build a Credential Provider.)
Reference: Login to windows xp programatically