示例#1
0
        private static async Task DeployConsole(MachineViewModel viewModel)
        {
            viewModel.Log.Add(new LogViewModel(LogLevel.Information, $"Logining to {viewModel.Host}"));

            using (new Impersonation(viewModel.User.Split('\\')[0], viewModel.User.Split('\\')[1], viewModel.Pass))
            {
                viewModel.Log.Add(new LogViewModel(LogLevel.Information, "Killing Admin Console"));
                await WmiProcess.KillAsync("Norskale Administration Console.exe", viewModel.Host, viewModel.User, viewModel.Pass);

                viewModel.Log.Add(new LogViewModel(LogLevel.Information, "Copy binaries"));
                await Task.Factory.StartNew(
                    () => DirectoryCopy(viewModel.Path,
                                        $@"\\{viewModel.Host}\C$\Program Files (x86)\Norskale\Norskale Administration Console\", true));

                viewModel.Log.Add(new LogViewModel(LogLevel.Information, "Done"));
            }
        }
示例#2
0
        private static async Task DeployBroker(MachineViewModel viewModel)
        {
            viewModel.Log.Add(new LogViewModel(LogLevel.Information, $"Logining to {viewModel.Host}"));

            using (new Impersonation(viewModel.User.Split('\\')[0], viewModel.User.Split('\\')[1], viewModel.Pass))
            {
                viewModel.Log.Add(new LogViewModel(LogLevel.Information, "Stopping Broker Service"));
                var service = new ServiceController("Norskale Infrastructure Service", viewModel.Host);
                await Task.Factory.StartNew(
                    () =>
                {
                    if (service.Status != ServiceControllerStatus.Stopped)
                    {
                        service.Stop();
                        service.WaitForStatus(ServiceControllerStatus.Stopped);
                    }
                });

                viewModel.Log.Add(new LogViewModel(LogLevel.Information, "Killing Broker tools"));
                var configToolTask = WmiProcess.KillAsync("Norskale Broker Service Configuration Utility.exe", viewModel.Host, viewModel.User, viewModel.Pass);
                var dbToolTask     = WmiProcess.KillAsync("Norskale Database Management Utility.exe", viewModel.Host, viewModel.User, viewModel.Pass);
                await Task.WhenAll(configToolTask, dbToolTask);

                viewModel.Log.Add(new LogViewModel(LogLevel.Information, "Copy binaries"));
                await Task.Factory.StartNew(
                    () => DirectoryCopy(viewModel.Path,
                                        $@"\\{viewModel.Host}\C$\Program Files (x86)\Norskale\Norskale Infrastructure Services\", true));

                viewModel.Log.Add(new LogViewModel(LogLevel.Information, "Starting Service"));
                await Task.Factory.StartNew(
                    () =>
                {
                    service.Start();
                    service.WaitForStatus(ServiceControllerStatus.Running);
                });

                viewModel.Log.Add(new LogViewModel(LogLevel.Information, "Done"));
            }
        }
示例#3
0
        private static async Task DeployAgent(MachineViewModel viewModel)
        {
            viewModel.Log.Add(new LogViewModel(LogLevel.Information, $"Logining to {viewModel.Host}"));

            using (new Impersonation(viewModel.User.Split('\\')[0], viewModel.User.Split('\\')[1], viewModel.Pass))
            {
                viewModel.Log.Add(new LogViewModel(LogLevel.Information, "Stopping Agent Service"));
                var service = new ServiceController("Norskale Agent Host Service", viewModel.Host);
                await Task.Factory.StartNew(
                    () =>
                {
                    if (service.Status != ServiceControllerStatus.Stopped)
                    {
                        service.Stop();
                        service.WaitForStatus(ServiceControllerStatus.Stopped);
                    }
                });

                viewModel.Log.Add(new LogViewModel(LogLevel.Information, "Killing Agent UI"));
                await WmiProcess.KillAsync("VUEMUIAgent.exe", viewModel.Host, viewModel.User, viewModel.Pass);

                viewModel.Log.Add(new LogViewModel(LogLevel.Information, "Copy binaries"));
                await Task.Factory.StartNew(
                    () => DirectoryCopy(viewModel.Path,
                                        $@"\\{viewModel.Host}\C$\Program Files (x86)\Norskale\Norskale Agent Host\", true));

                viewModel.Log.Add(new LogViewModel(LogLevel.Information, "Starting Service"));
                await Task.Factory.StartNew(
                    () =>
                {
                    service.Start();
                    service.WaitForStatus(ServiceControllerStatus.Running);
                });

                viewModel.Log.Add(new LogViewModel(LogLevel.Information, "Done"));
            }
        }