(Beginner) hello,
now that the formalities are out of the way, i was wondering if any of you here have any experience of UAC.
my reasons for asking are as follows. im working on a small FSU(Field Service Utility) to aide us field engineers with a client we have, problem i got it the clients systems run EnabledLUA to to 0 - effectivley disabled.
i can run the app with admin rights if i left shift and right click the app and select run as different user, and so far im managing this way but sort of defies the point of it.
so my question is how do i force the Runas or UAC prompts with uac disabled
i already have this in my program.cs
but with uac disabled this cause the program to hang on load and if i check task manager i can see the app closing and reopening constantly with only one way to stop it which is logout/rebboot
any help appreciated
thanks
phil
p.s forgot to add
i already have requireAdministrator in my app manifest file
now that the formalities are out of the way, i was wondering if any of you here have any experience of UAC.
my reasons for asking are as follows. im working on a small FSU(Field Service Utility) to aide us field engineers with a client we have, problem i got it the clients systems run EnabledLUA to to 0 - effectivley disabled.
i can run the app with admin rights if i left shift and right click the app and select run as different user, and so far im managing this way but sort of defies the point of it.
so my question is how do i force the Runas or UAC prompts with uac disabled
i already have this in my program.cs
C#:
static void Main()
{
WindowsPrincipal pricipal = new WindowsPrincipal(WindowsIdentity.GetCurrent());
bool hasAdministrativeRight = pricipal.IsInRole(WindowsBuiltInRole.Administrator);
if (!hasAdministrativeRight)
{
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.UseShellExecute = true;
startInfo.WorkingDirectory = Environment.CurrentDirectory;
startInfo.FileName = Application.ExecutablePath;
startInfo.Verb = "runas";
try
{
Process p = Process.Start(startInfo);
Application.Exit();
}
catch (System.ComponentModel.Win32Exception ex)
{
MessageBox.Show("This utility requires elevated priviledges to complete correctly.", "Error: UAC Authorisation Required", MessageBoxButtons.OK);
//Debug.Print(ex.Message);
return;
}
}
else
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
but with uac disabled this cause the program to hang on load and if i check task manager i can see the app closing and reopening constantly with only one way to stop it which is logout/rebboot
any help appreciated
thanks
phil
p.s forgot to add
i already have requireAdministrator in my app manifest file
Last edited: