Run process with admin rights

Hi,
I’m trying to run a cmd command using the Keyword “Run Process”, but the problem is that this cmd command needs admin rights, so I’m not sure how to do it, I tried running the robot test from a cmd that is opened as administrator but it didn’t really help.
Thanks in advance

Hi Mohamed,

On Windows you’ll want to use runas:

runas /user:"your_computer_name\administrator_name" "C:\path\program.exe"

On Mac OS or Lunix you need sudo.

sudo -u admin_username program

Problem is you’ll need to enter a password, and particularly with the Windows version Microsoft went to great lengths to intentionally prevent it from being automated, so you will need to have someone present to deal with the UAC prompt.

A better way would be to run the install from a process that has admin rights before your test.

Hope this helps,

Dave.

1 Like