Application.RequestAdminPrivilege
Skip to content
mnscript
StringResult Application.RequestAdminPrivilege() 

Description ​

Requests admin privilege be granted to the program. The program is paused until a result is returned.

Returns ​

StringResult - True if the admin privilege was granted by the user.

Example ​

msc
using Application;
using Console;
using System;

// Requests admin privileges from the user.

StringResult result = Application.RequestAdminPrivilege();

if(result.GetResult() == true){
    Console.WriteLine("Admin Privileges granted.");
}else{
    // If the request was denied, the reason will be contained in the result's string.

    string reason = result.GetString();
    Console.WriteLine("Admin Privileges denied: "..reason);
}