Programmatically execute a program using Avecto Privilege Guard?
My company uses 'Avecto Privilege Guard' to control administrator access on company computers. This creates a right click context menu that when activated, runs the program in an administrator account rather than the local user's account.
The system is functional, but it's annoying because the right click option only appears on files and shortcuts - it doesn't appear when right clicking on the pinned applications or recently opened applications in the start menu. Also, it's easy to open a program that usually needs to be run in administrator mode in regular user mode.
Is there any way to call Avecto Privilege Guard programmatically - for instance, from a batch file, the command prompt, or a C application? I had a dig around in the underlying dll that I assume drives the creation of the right-click option, 'PGHook.dll', but this isn't my area of expertise and I couldn't find anything.
Solution 1:
In the command line, you can call avecto
as in:
avecto C:\Windows\System32\WindowsPowerShell\v1.0\powershell_ise.exe
If you want an automated way to do it, put it in a .ps1
or a .bat
Solution 2:
Running specifically programmatically doesnt really work. But, there are some things you can do.
For the pinned items in the start menu, hold shift and right click them. The Avecto - Run with Admin Rights (Audited) shortcut should show up).
But, anything you want to run with a batch file you can do, just run cmd.exe using Run with Admin Rights. You can point it to execute anything you want as far as I know. This has worked for me so far.
Solution 3:
Since avecto.bat is not available anymore you can use a general program requesting elevation like Johannes Passing Elevate.exe. Then just use elevate as you has used avecto, e.g.
elevate prog.exe
or
elevate -k script.cmd
As a nice side effect it works in arbitrary environments.