public async Task PerformAsync() { ProcessInfo = new ProcessStartInfo(ProcessFileName, ProcessArgs) { WorkingDirectory = ProcessStartPath }; ProcessInfo.UseShellExecute = true; try { bool IsAdmin = new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator); if (LaunchAsAdmin && IsAdmin) { Process.Start(ProcessInfo); } else { if (IsAdmin) { ProcessLauncher.ExecuteProcessUnElevated(ProcessInfo.FileName, ProcessInfo.Arguments, ProcessInfo.WorkingDirectory); } else { Process.Start(ProcessInfo); } } }catch (Exception ex) { MessageBox.Show($"Could not Launch Process on Macro {Name}. Error: {ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } await Task.Delay(0); }