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

2) The CPAU command

 

You will need to download the CPAU 1.10 executable from the official website.

Next, copy the unzipped file (CPAU.exe) into the %systemroot%\system32 folder (normally c:\windows\system32).

CPAU is a command line tool that allows you to start a program and specify the user account and password to use. It will also allow you to encrypt the script in a text file. The following parameters are those that you will need to use:

-u username

-p password

-ex executable name

-file specifies the location and name of the text file that contains the scripts parameters

-enc encodes the script in a txt file

-dec decodes the txt file to be executed in the script

-cwd specifies the working folder

-profile loads the user’s profile

 

Let’s take a look at the Scandisk application (chkdisk.exe).

The first command you need to input is the following:

Cpau –u administrator –p password –file c:\chkdsk.txt –ex chkdsk.exe –cwd c:\winnt\temp –enc

CPAU will create an encrypted file named checkdsk.txt containing the script information. CPAU will only keep the command, username and password in this command file. If you want to define a working folder (obligatory in certain cases), then you will need to input this when asked for the text file.

If you edit this file with notepad, you will see something like this:

Image

Next, you will need to create another script in notepad:

Cpau –file c:\chkdsk.txt  –dec –profile 

With a working directory of the following:

Cpau –file c:\chkdsk.txt  –dec –profile –cwd c:\winnt\temp 

And save it with the .cmd extension.

Image

You can then copy this file to your desktop or to wherever you are going to run the script from.

CPAU also supports UNC names:

Example:

  • CREATION OF CPAU TXT FILE

Cpau –u administrator –p password –file \\server\netlogon\chkdsk.txt –ex chkdsk.exe –enc

  • CALLING A CPAU TXT FILE

Cpau – file:\\server\netlogon\chkdsk.txt –dec -profile -cwd c:\winnt\temp

NB: If you execute a CPAU script from a network location (connection script for example), the –cwd command is necessary otherwise it wont work.

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