Ejemplo n.º 1
0
        public void Run(ILogger logger)
        {
            if (_config.Commands.Count == 0)
            {
                logger.Warning($"Skipping task '{_config.Description}' as no commands set for task.");
                return;
            }

            _powershellRunner.RunCommands(_config.Commands.ToArray());
        }
Ejemplo n.º 2
0
        public void Run(ILogger logger)
        {
            var commands = new List <string>();

            foreach (string feature in _config.Features)
            {
                string command   = "";
                string extraArgs = "";

                if (_config.IsWindows10)
                {
                    extraArgs = (_config.IncludeAllSubFeatures) ? " -All" : "";

                    if (_config.ShouldRemove)
                    {
                        command = $"Disable-WindowsOptionalFeature -Online{extraArgs} -Featurename {feature}";
                    }
                    else
                    {
                        command = $"Enable-WindowsOptionalFeature -Online{extraArgs} -Featurename {feature}";
                    }
                }
                else
                {
                    extraArgs = (_config.IncludeAllSubFeatures) ? " -IncludeAllSubFeature" : "";
                    if (_config.ShouldRemove)
                    {
                        command = $"Uninstall-WindowsFeature {feature}{extraArgs}";
                    }
                    else
                    {
                        command = $"Install-WindowsFeature {feature}{extraArgs}";
                    }
                }

                commands.Add(command);
            }

            _powershellRunner.RunCommands(commands.ToArray());
        }
Ejemplo n.º 3
0
 public void Run(ILogger logger)
 {
     _powershellRunner.RunCommands(new string[] { "iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex" });
 }