Desktop.RunAsRoot (gb.desktop)

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

  • Command

  • Wait

Run the specified Command as root, 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 https://command-not-found.com/pkexec