Ejemplo n.º 1
0
        public async Task <bool> RebootComputerAsync(String ComputerName, String CurrentUser, String PoolName, DateTime Now)
        {
            var pool = await this.GetPoolByIdAsync(PoolName);

            var password     = this.Pw.Decrypt(pool.RemoteAdminPassword, pool.InitializationVector);
            var RebootResult = await this.CompMgmt.RebootComputerAsync(ComputerName, pool.RemoteAdminUser, password, Properties.Settings.Default.ActiveDirectoryDomain, Properties.Settings.Default.ActiveDirectoryDNSDomain);

            if (!RebootResult)
            {
                await this.LogEventAsync("REBOOT FAILED", CurrentUser, ComputerName, PoolName, Now);

                var msg = String.Format(Properties.Resources.RebootFailedEmailMessage, ComputerName);
                // TODO: IOC these arguments for testability.
                await Smtp.SendMailAsync(Properties.Settings.Default.SmtpServer, Properties.Settings.Default.SmtpMessageFromAddress, pool.EmailNotifyList, msg, msg);
            }
            return(RebootResult);
        }
Ejemplo n.º 2
0
        public async Task LogAndEmailPoolFullEventAsync(String PoolName, String ComputerName, String UserName, DateTime Now)
        {
            await this.LogEventAsync("POOL FULL", UserName, ComputerName, PoolName, Now);

            var msg  = String.Format(Properties.Resources.LabPoolIsFullEmailMessage, PoolName);
            var pool = await this.GetPoolByIdAsync(PoolName);

            // TODO: IOC these arguments for testability.
            await Smtp.SendMailAsync(Properties.Settings.Default.SmtpServer, Properties.Settings.Default.SmtpMessageFromAddress, pool.EmailNotifyList, msg, msg);
        }