Desktop.RunAs (gb.desktop)

Static Sub RunAs ( UserName As String, Command As String [ , Wait As Boolean ] )

  • UserName

  • Command

  • Wait

Run the specified Command as another UserName, by using the desktop-specific tool if possible.

Using Wait will wait till Command has finished before continuing.

If no desktop-specific tool is found it will raise an error with the message "No graphical sudo program found".

The Command string is Split() for use with the EXEC command using "Double quotes" not 'single quotes' so be sure not to use single quotes to encapsulate arguments.

Requires one of the following tools to be installed...
  • pkexec

  • gksudo

  • kdesudo

  • lxde-sudo

Most of the above are obsolete and no longer available except pkexec that is a part of the policykit package or polkit.

See how to install pkexec on your system here