Review System
Execute a program as Administrator

This tutorial will explain how to create scripts that will allow you to start an application with someone else's user account so that you have administrator rights. User's accounts do not allow you to install or execute certain programs. By using this method you can control this problem by giving specific programs administrator rights under your user account.

Execute a program as Administrator

April 03rd, 2005 - 06:00 pm ET by Vanzetti44

You can also put this executable on the users desktop or in a folder accessible to everyone (Program Files\Scripts\ for example) and create a shortcut to the desktop. This will allow you to change the icon and name to something that is more understandable.

To compile you aut script, you can also use the Aut2exe program (Programs\AutoIT\Autoit2Exe).

 

Image

Select the aut source file that you want to compile.

 

Image

If you don’t specify a destination, AutExe will use the current folder as the default.

In "Custom Icon", select an ".iso" or ".exe" file.

Image

NB: Under Windows, the shell32.dll file contains all of the standard Windows icons. This can be found in the %Systemroot%\System32 folder (normally c:\windows\system32). Edit this file with Irfanview to extract the icons and save them under ".ico".

Your file should now look something like this:

 

Image

If you edit the executable, you will see something like the following:

 

Image

You should be aware that Cpau only knows how to generate executable files. The mmc console types like dfrg.msc (Disk Defrag) or gpedit.msc (Group Polocies) can not be started with Cpau. You will therefore need to use other scripts for these :p

Lets take a look at the mmc defrag console, dfrg.msc for example.

Create a cmd script with notepad that contains only the following:

Dfrg.msc

Save this in any folder and rename it to "dfrg.cmd" (I have saved it to c:\scripts).

Then create a script that looks like this:

Run,cpau -u administrator -p password -ex c:\\scripts\\dfrg.cmd -cwd c:\\winnt\\temp

Under Winodws XP/2003, the defrag utility is defrag.exe.

If you want to launch the CPAU scripts from a network location, or a connection script (logon script) then you will need to add the following parameters to you aut script:

Run, cpau -profile -u administrator -p password -ex c:\\winnt\\system32\\chkdsk.exe -cwd c:\\winnt\\temp

The –cwd parameter defines your working folder.

Once this script has been created, it is not necessary to install AutoIT on all the machines.

You should also read the help files that are provided with AutoIT and CPAU so that you can make more efficient scripts.

next page » Page 5 / 8 « previous page Post a comment
Previous review Next review
Guide to Windows XP optimisation Discover SmartFTP a complete and free FTP client