Beispiel #1
0
        private static FeatureCommandsCollection CreateCommandsImpl(IEnumerable <IISFeature> features, CommandOptions commandOptions)
        {
            var commands = new FeatureCommandsCollection();

            try
            {
                bool internetInformationServerIsPresent = RegistryOperations.CheckMachineKey(@"SOFTWARE\Microsoft\InetStp");
                if (!internetInformationServerIsPresent)
                {
                    // IIS not installed > :-( Begin installation
                    commands.Add(FeatureCommand.Create("IIS-DefaultDocument", "All"));
                }

                commands.InternetInformationServerIsPresent = internetInformationServerIsPresent;

                // IIS installed
                //  > Enable All Features > Install
                foreach (IISFeature feature in features)
                {
                    commands.Add(FeatureCommand.Create(feature, options: commandOptions));
                }

                return(commands);
            }
            catch
            {
                return(commands);
            }
        }