TechTips.co.za

Useful Tech Tips, Tutorials and guides

Run command as administrator

Run command or Install a program as administrator

One of the common issues faced by IT Teams is installing or completing administrative tasks either remotely, or while logged on as a user with limited rights. The easiest way to complete this is to use the runas command to run the application / file as an administrative user.

  1. Click Start
  2. Type CMD.EXE in the search box.
  3. Type RUNAS /USER:\

You can also use “COMPUTERNAME\ADMINISTRATOR”. The command will then prompt you to enter the password, which is masked from the user (it will just appear as if there is nothing typed).

This is useful if installing from the user’s profile etc, but have had limited success in running apps like this.

If at all possible try to run CMD its self with elevated rights and then running the installer from the CMD prompt, You can even run MSI files This can be done by using the MSIEXEC –I  Command.

Note: Beware of windows UAC (User Account Control) when working remotely, It is best to use RDP or Radmin which will allow you to enter credentials when prompted for UAC.

Access network with CMD

Should you need to get access to a network location while at a CMD prompt you can use the PUSHD Command. This command maps a drive letter as the network location, ensure you use the full UNC path name (eg \127.0.0.1\Share). You will see the command prompt change to the mapped drive after typing the command.

If you need to unmap the previously mapped drive you can use the POPD Command or just exit the command prompt.