コード例 #1
0
 public static SystemState GetSystemState(ManagementScope scope, string serverName, string userName, string password, ILogger logger)
 {
     try
     {
         ManagementScope serverDefaultPath = WMIUtils.ConnectToServerDefaultPath(serverName, userName, password);
         return(SystemStateReader.GetSystemState(scope, serverDefaultPath, serverName, logger));
     }
     catch (Exception ex)
     {
         logger.Verbose("Exception thrown getting the system state for server " + serverName + ". Exception: " + ex.Message, "SystemState");
         throw;
     }
 }
コード例 #2
0
ファイル: WMIUtils.cs プロジェクト: phspies/OculiService
    public static ManagementScope ConnectToServerDefaultPath(string server, NetworkCredential credentials)
    {
        string userName = CUtils.CombinUsernameAndDomain(credentials.UserName, credentials.Domain);

        return(WMIUtils.ConnectToServerDefaultPath(server, userName, credentials.Password));
    }