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?
apache09Connect With a Mentor Commented:
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.
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.
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.