UAC is admittedly kind of annoying, but I tend to think of it as a necessary evil when you start looking at all of the things out there that can mess up your computer. Some things require you to run as administrator. This isn’t a problem when you can control the executable, but if you are trying to run a script or something that you don’t have full control over, it can be kind of annoying to ask the user to manually run as administrator.
Luckily, there’s a programming way:
Essentially, the script first checks to see if it is already running as administrator, and, if it isn’t, writes out a vbs script to launch as administrator and then re-launch the script.
You could easily extend this to launch another program or basically do whatever you want after the :gotAdmin label. The nice thing is that it isn’t dangerous to use – its still requiring the user to approve the action as an administrator… so if they don’t have access, they won’t be able to do anything with it.