diff --git a/VSLauncherX/Helpers/AutoRun.cs b/VSLauncherX/Helpers/AutoRun.cs index 047ff6f..b512f75 100644 --- a/VSLauncherX/Helpers/AutoRun.cs +++ b/VSLauncherX/Helpers/AutoRun.cs @@ -108,7 +108,7 @@ private static string GetUserName(WindowsIdentity user) /// /// Runs the. /// - internal static void Run() + internal static bool Run() { // Get the service on the local machine using (TaskService ts = new TaskService()) @@ -129,8 +129,11 @@ internal static void Run() if (folder.AllTasks.Any(t => t.Name == taskName)) { folder.Tasks[taskName].Run(); + return true; } } + + return false; } /// diff --git a/VSLauncherX/Program.cs b/VSLauncherX/Program.cs index cf9d603..fbb9722 100644 --- a/VSLauncherX/Program.cs +++ b/VSLauncherX/Program.cs @@ -44,14 +44,21 @@ static void Main() UpdateTaskScheduler(); } - if (!Settings.Default.AlwaysAdmin) + bool bAdmin = AdminInfo.IsCurrentUserAdmin(); + bool bElevated = AdminInfo.IsElevated(); + + if (!Settings.Default.AlwaysAdmin || bAdmin || bElevated) { Application.Run(new MainDialog()); } else { // we are started normally - AutoRun.Run(); + if(!AutoRun.Run()) + { + Application.Run(new MainDialog()); + } + } } }