Ejemplo n.º 1
0
 private static bool?TryEnableRdp(object state)
 {
     try
     {
         var fav = state as IFavorite;
         if (fav == null)
         {
             return(null);
         }
         return(RemoteManagement.EnableRdp(fav));
     }
     catch // dont need to recover (registry problem, RPC problem, UAC not happy)
     {
         return(null);
     }
 }
Ejemplo n.º 2
0
        private string TryPerformRemoteShutdown(object state)
        {
            try
            {
                var options = state as Tuple <ShutdownCommands, IFavorite>;

                if (options != null && RemoteManagement.ForceShutdown(this.persistence, options.Item2, options.Item1))
                {
                    return("Terminals successfully sent the shutdown command.");
                }

                return(shutdownFailMessage);
            }
            catch (ManagementException ex)
            {
                Logging.Info(ex.ToString(), ex);
                return(shutdownFailMessage + "\r\nPlease check the log file for more details.");
            }
            catch (UnauthorizedAccessException)
            {
                return(shutdownFailMessage + "\r\n\r\nAccess is Denied.");
            }
        }