Logging into Administrator account using a batch file?

Posted on 2008-11-10
Last Modified: 2012-05-05
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!
Question by:tst_
    LVL 47

    Accepted Solution

    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.
    LVL 17

    Expert Comment

    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.
    LVL 23

    Expert Comment

    by:Malli Boppe
    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.
    LVL 12

    Expert Comment

    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.

    Author Comment

    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.
    LVL 23

    Expert Comment

    by:Malli Boppe
    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.

    Featured Post

    Are end users causing IT problems again?

    You’ve taken the time to design and update all your end user’s email signatures, only to find out they’re messing up the HTML, changing the font and ruining the imagery. What can you do to prevent this? Find out how you can save your signatures from end users today.

    Join & Write a Comment

    This article was inspired by a question here at Experts Exchange ( The requirements stated in that question are (1) reduce the file size of a large number of…
    Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
    Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
    In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now