private void btnWebcam_Click(object sender, RoutedEventArgs e) { var id = WindowsIdentity.GetCurrent(); if (id.User == id.Owner) { try { ProcessStartInfo info = new ProcessStartInfo(); info.Verb = "runas"; // we'll run our EXE as admin info.UseShellExecute = true; string localAppDataPath = Windows.ApplicationModel.Package.Current.InstalledLocation.Path; info.FileName = localAppDataPath + @"/Nova Control Center/Nova Control Center.exe"; // path to the appExecutionAlias Process.Start(info); // launch new elevated instance App.Current.Shutdown(); // exit current instance } catch (Exception) { if (btnWebcam.IsChecked == true) { btnWebcam.IsChecked = false; } else { btnWebcam.IsChecked = true; } MessageBox.Show("Please run as Administrator!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } else { if (btnWebcam.IsChecked == false) { bool isEmpty = PowershellFunctions.isEmpty(); if (isEmpty == false) { Task task = PowershellFunctions.EnableCameraInstances(); } } else { Task task1 = PowershellFunctions.SaveCameraInstances(); bool isEmpty = PowershellFunctions.isEmpty(); if (isEmpty == false) { Task task2 = PowershellFunctions.DisableCameraInstances(); } } } }