diff --git a/CHANGELOG.md b/CHANGELOG.md index 320456831..7db6bf239 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,8 @@ - Changes to Examples - Created new folder structure for examples so that examples will be placed in `/Examples/Resources/$resourceName` ([issue #483](https://github.com/PowerShell/xWebAdministration/issues/483)) +- Moved examples out of Readme + - Moved examples from Readme.md to respective `/Examples/Resources/` folders. ([issue #486](https://github.com/PowerShell/xWebAdministration/issues/486)) ## 2.8.0.0 diff --git a/Examples/Resources/xWebSite/Sample_xWebsite_StopDefault.ps1 b/Examples/Resources/xWebSite/Sample_xWebsite_StopDefault.ps1 new file mode 100644 index 000000000..ac4f008ce --- /dev/null +++ b/Examples/Resources/xWebSite/Sample_xWebsite_StopDefault.ps1 @@ -0,0 +1,34 @@ +<# + .SYNOPSIS + When configuring a new IIS server, several references recommend removing or stopping the default website for security purposes. + This example sets up your IIS web server by installing IIS Windows Feature. + After that, it will stop the default website by setting `State = Stopped`. +#> +Configuration Sample_xWebsite_StopDefault +{ + param + ( + # Target nodes to apply the configuration + [string[]]$NodeName = 'localhost' + ) + # Import the module that defines custom resources + Import-DscResource -Module xWebAdministration + Node $NodeName + { + # Install the IIS role + WindowsFeature IIS + { + Ensure = "Present" + Name = "Web-Server" + } + # Stop the default website + xWebsite DefaultSite + { + Ensure = "Present" + Name = "Default Web Site" + State = "Stopped" + PhysicalPath = "C:\inetpub\wwwroot" + DependsOn = "[WindowsFeature]IIS" + } + } +} diff --git a/README.md b/README.md index 326d94d55..f80d87fb6 100644 --- a/README.md +++ b/README.md @@ -498,43 +498,6 @@ xPhp -PackageFolder "C:\packages" ` -installMySqlExt $false ``` -## Stopping the default website - -When configuring a new IIS server, several references recommend removing or stopping the default website for security purposes. -This example sets up your IIS web server by installing IIS Windows Feature. -After that, it will stop the default website by setting `State = Stopped`. - -```powershell -Configuration Sample_xWebsite_StopDefault -{ - param - ( - # Target nodes to apply the configuration - [string[]]$NodeName = 'localhost' - ) - # Import the module that defines custom resources - Import-DscResource -Module xWebAdministration - Node $NodeName - { - # Install the IIS role - WindowsFeature IIS - { - Ensure = "Present" - Name = "Web-Server" - } - # Stop the default website - xWebsite DefaultSite - { - Ensure = "Present" - Name = "Default Web Site" - State = "Stopped" - PhysicalPath = "C:\inetpub\wwwroot" - DependsOn = "[WindowsFeature]IIS" - } - } -} -``` - ### Create a new website While setting up IIS and stopping the default website is interesting, it isn’t quite useful yet.