The Problem
Most users of Windows XP run as local Administrators all the time. Everyone knows this is not the best way to work from a security standpoint After all, most nasty stuff (viruses, worms, spyaware) gets onto a computer because of either email or malicious web sites, and these nasties can only get installed on the system if you read your email or browse web sites as an Administrator. People know this, but they still run as an Admin because running as an unprivileged user is inconvenient. If you do run as a User and you need to do something as an Administrator, you either have to use
runas from a command prompt, or log out/switch users to a privileged account. Kind of a pain. Also, this means that you are making changes under a different account - you can't access your network resources, and changes that affect the profile are touching the profile of the Administrator account, not the profile of your "regular" account.
Solutions
There are basically two approaches to solve this problem. One is to run as an Administrator and to selectively drop down to a regular User for "risky" actions (like web browsing). This is the solution offered by the program DropMyRights. The solution I prefer is to run as a regular user all the time, and then selectively elevate your current account privileges whenever you need to run as an Administrator. Aaron Margosis discusses a tool to do this in his
MakeMeAdmin blog post. MakeMeAdmin takes your
current account, adds it to the Administrators group, opens a DOS prompt under this elevated account, then removes your account from the Administrators group. Thus, you run your normal account as an Administrator, but only in the context of that DOS prompt.
His solution is good, but it still leaves you with only a DOS command (unless you choose to run each Explorer window in a separate process, which I found can chew up memory). Also, I didn't like the way the batch file prompted me for passwords twice. I wanted a graphical window to enter both passwords at once, and then have it take me to graphical environment in which I was a member of the Administrator's group.

I solved this problem by extending Aaron's concept with an
AutoIt script. The script prompts me for the name of an Administrator account, the password of that account, and the password of my current account. It then searches for something to run. It can run a batch file named
<scriptname>.bat or
<scriptname>.cmd, where
<scriptname>is the file name of the RunAsAdmin executable, minus the extension. This allows you to use it to run any program that requires Administrator access.
Alternatively, RunAsAdmin can run the A43.exe executable.
A43 is a file management utility. I first learned about this program through the excellent
BartPE boot disk, which uses it as an Explorer substitute.
Click the image below to see the effect of running RunAsAdmin with A43 on your computing environment.

The Script and how to use it
You can download the compiled executable from here:
Move the file RunAsAdmin.exe into a folder. If you want to use RunAsAdmin with A43, download
A43 and extract it into the same directory as RunAsAdmin, so that the file A43.exe is in the same folder as RunAsAdmin.exe. Otherwise, you can create a batch file called RunAsAdmin.bat in the same folder and RunAsAdmin will run that. If you rename RunAsAdmin, you must rename the batch file to match its new name except for the
.bat extension.
Once you have it set up, just run the RunAsAdmin.exe program. It will prompt you for the name of an account that is already a member of the Administrators group. (If you click the check box, it will store this account name in the registry so that you don't have to enter it the next time). It will also prompt you for the password of the administrator account, and your current account's password. Once you click OK, it will add your account to the Administrators group, run either the batch file or A43, and then remove you account from the Administrators group.
One other thing to note is that if you use this method for making changes to your system, you should make the Administrators group the Owner of new files that you create while you are an Administrator. Otherwise, malware could affect changes you made while your privileges were elevated. See Aaron's discussion of this issue
in this blog post.
The ZIP archive above also contains the source code for the script, so you can edit it to your needs. You'll need AutoIt to run or compile it. The script as written requires a splash screen, so I also included the one that I used.
Final Thoughts
Since my first version of this script, I have been running for months as a regular user on several of my production boxes. I don't find it very inconvenient. After a while I have learned to run RunAsAdmin once and then to leave it open for when I want to run Admin tasks. I also use it to run a program that refuses to run as anything other than as an Administrator, and that requires network access.
I have found using the script to be a minor inconvenience compared to the risks of running as an Administrator. I say this as someone who has not seen a virus on his system in years and who has never had a problem with spyware. However, I don't doubt that someday, someone would eventually come up with a way to trip me up if I continued to run as an Administrator. That's why I want to run as a regular user - I just think that this is a better way to run.