Esempio n. 1
0
        static void Main(string[] args)
        {
            if (!EventLog.SourceExists(SOURCE))
            {
                EventLog.CreateEventSource(SOURCE, LOG);
            }

            var wbMgr = new WebManager();

            try
            {
                wbMgr.GetAuthCookie().Wait();
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(ExceptionMessage(e));
#if DEBUG
                Console.ReadLine();
#endif
                return;
            }
            try
            {
                var computer = wbMgr.GetGroupNameAsync().Result;
                wbMgr.SetCurrentVersion(
                    new VersionModel
                {
                    ApplicationName    = VersionManager.GetApplicationName(),
                    ApplicationVersion = VersionManager.GetApplicationVersion(),
                    ComputerName       = computer.Name,
                    ComputerGroup      = computer.Group
                }).Wait();
                ServicesManager.StopService(SERVICE_NAME);
                CertificateManager.InstallCerticate(wbMgr.GetCertificate().Result);
                RegistryManager.RegisterKey(computer);
                ServicesManager.StartService(SERVICE_NAME);
                WsusManager.CheckUpdate();
                WsusManager.WsusCheckWsus();
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(ExceptionMessage(e));
#if DEBUG
                Console.ReadLine();
#endif
                return;
            }
#if DEBUG
            Console.ReadLine();
#endif
        }