Not happy with the default installation of IIS? Do you fancy a more “clean” approach? Read on!
This post is part of a series, at the bottom you find links to the other parts. In this part we will take the next step into making your environment configurations even more manageable.
First step is to configure our environment as descibed in the previous post.
Install modules
Install-Module xWebAdministration
Create partial configurations
Now let’s create the IIS blueprint: InstallIIS
# A configuration to install default IIS instance Configuration InstallIIS { Import-DscResource -ModuleName 'PSDesiredStateConfiguration' WindowsFeature IIS { Ensure = "Present" Name = "Web-Server" } WindowsFeature IISManagementTools { Ensure = "Present" Name = "Web-Mgmt-Tools" DependsOn='[WindowsFeature]IIS' } }
Now let’s create the IIS blueprint: ConfigureIIS
# A configuration to configure / cleanup a default IIS instance Configuration ConfigureIIS { Import-DscResource -ModuleName 'PSDesiredStateConfiguration','xWebAdministration' xWebAppPool RemoveDotNet2Pool { Name = ".NET v2.0"; Ensure = "Absent"} xWebAppPool RemoveDotNet2ClassicPool { Name = ".NET v2.0 Classic"; Ensure = "Absent"} xWebAppPool RemoveDotNet45Pool { Name = ".NET v4.5"; Ensure = "Absent"} xWebAppPool RemoveDotNet45ClassicPool { Name = ".NET v4.5 Classic"; Ensure = "Absent"} xWebAppPool RemoveClassicDotNetPool { Name = "Classic .NET AppPool"; Ensure = "Absent"} xWebAppPool RemoveDefaultAppPool { Name = "DefaultAppPool"; Ensure = "Absent"} xWebSite RemoveDefaultWebSite { Name = "Default Web Site"; Ensure = "Absent"; PhysicalPath = "C:\inetpub\wwwroot"} }
The new LEGO manual
Now let’s ensemble our environment with the blueprint we have created.
[DscLocalConfigurationManager()] Configuration ConfigureTestMachine { PartialConfiguration AssertDC { Description = 'Create a Domain Controller' RefreshMode = 'Push' } PartialConfiguration AllowSecureRDP { Description = 'Enable secure RDP connections' RefreshMode = 'Push' DependsOn = '[PartialConfiguration]AssertDC' } PartialConfiguration InstallIIS { Description = 'Install IIS' RefreshMode = 'Push' DependsOn = '[PartialConfiguration]AssertDC' } PartialConfiguration ConfigureIIS { Description = 'Configure IIS' RefreshMode = 'Push' DependsOn = '[PartialConfiguration]InstallIIS' } }
Compile the stuff into MOF files
We now have created all the script parts we need, it time to compile it all into MOF files.
# Compile the partial configuration "InstallIIS" InstallIIS -outputpath c:\InstallIIS # Compile the partial configuration "ConfigureIIS" ConfigureIIS -outputpath c:\ConfigureIIS # Compile the "ensamble" configuration "ConfigureTestMachine " ConfigureTestMachine -outputpath c:\ConfigureTestMachine
Update our DSC Configuration
Set-DscLocalConfigurationManager -Path c:\ConfigureTestMachine -Verbose Publish-DscConfiguration -path c:\InstallIIS -verbose Publish-DscConfiguration -path c:\ConfigureIIS -verbose Start-DscConfiguration -UseExisting -Wait
This post is seperated into multiple parts:
- What is DSC?
- Setting up the environment for DSC
- Configure Active Directory with DSC
- What LEGO has to do with PowerShell DSC Partial Configurations!
- Configure IIS with DSC(this post)
- Install SQL with DSC
- Install SharePoint
- Configure SharePoint
I have noticed you don’t monetize your website, don’t waste your traffic, you can earn extra cash every month because you’ve got high quality content.
If you want to know how to make extra bucks, search for: Mertiso’s tips best adsense alternative
LikeLike
I have checked your blog and i have found some duplicate
content, that’s why you don’t rank high in google, but there is a tool
that can help you to create 100% unique content, search for: boorfe’s tips unlimited content
LikeLike
I have noticed you don’t monetize your blog, don’t
waste your traffic, you can earn extra bucks every month because you’ve got hi
quality content. If you want to know how to make extra money, search
for: Ercannou’s essential adsense alternative
LikeLike
Ariel, Vosburg
LikeLike
Good afternoon, I was just checking out your site and filled out your contact form. The feedback page on your site sends you messages like this via email which is why you’re reading through my message at this moment right? That’s the most important achievement with any type of advertising, getting people to actually READ your message and I did that just now with you! If you have something you would like to promote to lots of websites via their contact forms in the U.S. or to any country worldwide send me a quick note now, I can even target specific niches and my prices are very reasonable. Write a reply here: lethamidurr@gmail.com
LikeLike