Logging into Administrator account using a batch file?

Ok, here is the deal:

I have a computer running Windows XP Professional SP2 which is a touch screen - and it automatically logs into a restricted user account which has limited capability, and an on screen keyboard to run searches or browse a program's menu.

In order to make any changes to this system, I would need to log into the Administrator account by plugging in a keyboard and repeatedly tapping shift to bypass the auto login to the restricted user account. This however is providing to be a bit time consuming, as the process can be hit or miss, resulting in the need to reboot the computer, and try again until you get the login prompt.

In the user account, privileges to command prompt and auto run (i.e: automatically run a CD or USB drive when it is plugged in) are left open for certain functions to operate. My question is this:

Is it possible to create a batch file which can be executed from a USB drive using an "autorun.ini" file so that upon plugging it into this computer, it logs out of the user account, and logs you directly into the Administrator account without the need to reboot?.

If not, are there other methods to do this efficiently without having to use the a fore mentioned method?

Thank you in advance!
Rajesh KumarAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Not that I know of.

And if there was a way, think about the security implications should such a key get lost?

Personally, not something I would want to be responsible for.

Below are the instructions for enabling automatic logon.

Make special note of the Bypass Option as it states, You can bypass this function by HOLDING DOWN the SHIFT key during the boot or logoff process.   

Automatic Logon to Windows NT, 2000 and XP:
Windows includes a feature that allows you to configure the computer to automatically logon to the network, bypassing the Winlogon dialog box.

To enable this function you need to add several new values to the key below:

1. Add a new string value named 'DefaultUserName' and set it to the username you wish to automatically logon as.

2. Add a new string value named 'DefaultPassword' and set this to the password for the user entered above.

3. Add a new string value named 'DefaultDomainName' and set this to the domain of the user. Ignore this value if the NT box is not participating in NT Domain security.

4. Add a new string value named 'AutoAdminLogon' and set it to either '1' to enable auto logon or '0' to disable it.

5. For Windows 2000 the additional ForceAutoLogon setting must be enabled to stop the tweak from resetting on reboot.

Exit and restart, Windows should not ask for a password and automatically show the desktop of the user.

Note: The password is stored in registry, which means anyone who has access to the machine has access to the password.

Note: You can bypass this function by holding down the SHIFT key during the boot or logoff process.

Note: It is also important to note that if the DontDisplayLastUserName value is enabled, the auto logon feature does not function.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
if you perform a task repeatedly, you could look at a batch file to run the program or command using the runas command but this will require storing the password.
Malli BoppeCommented:
You can use runas command and open a IE and type the drive letter of USB in the IE browser.

runas /user:domain\admin_test  "C:\Program Files\Internet Explorer\iexplore"
or you can use the below utility which would help you between switching to a restricted account and a admin account.
Protecting & Securing Your Critical Data

Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage

if you need admin acces you can start a command prompt with admin credentials after startup using run as
(right click cmd.exe and click run as, use your admin credentials), afterwards any program you start from that command prompt will be started with admin credentials.
Rajesh KumarAuthor Commented:
To give you an idea of what I had been working on:

I used PSTools:

And created a batch file which utilized the PsShutdown command with the parameters necessary to logoff the user. Then I created an autorun file which pointed to the batch file I created. This effectively created a USB drive which, when plugged in, logged off the current user.

The problem I'm running into now is that after logging off, it doesn't automatically redirect to the Administrator account. I'm assuming there isn't any possibility of adding an extended command to put into the batch file which loads credentials necessary to login to the Administrator account?.

Also, the runas method which was mentioned, though a very solid suggestion, unfortunately does not meet the needs I have for the system in question.
Malli BoppeCommented:
did you look into the utility that I mentioned.You don't need to logoff to switch between users account with the utility that I mentioned.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.