Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Confirm
Close Dialog

Run current process as admin (UAC control)

Description
This script runs a new instance of the process for the current window elevated.
Language
C#.net
Minimum Version
Created By
KarolPiechoczek
Contributors
-
Date Created
Aug 3, 2021
Date Last Modified
Aug 3, 2021

Scripted Function (Macro) Code

using System;
using System.Drawing;
using System.Diagnostics;

public static class DisplayFusionFunction
{
	public static void Run(IntPtr windowHandle)
	{
	uint processID = BFS.Application.GetAppIDByWindow(windowHandle);
        Process process = Process.GetProcessById(Convert.ToInt16(processID));
        string processPath = process.MainModule.FileName;

        Process proc = new Process();
        proc.StartInfo.FileName = processPath;
        proc.StartInfo.UseShellExecute = true;
        proc.StartInfo.Verb = "runas";  
        proc.Start();         
	}
}