Skip to content

Instantly share code, notes, and snippets.

@artisticcheese
Created February 24, 2017 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artisticcheese/d5bae27a14e5abe1d1eb57e36b558a5e to your computer and use it in GitHub Desktop.
Save artisticcheese/d5bae27a14e5abe1d1eb57e36b558a5e to your computer and use it in GitHub Desktop.
Configuration BasicIIS
{
Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
node localhost {
WindowsFeature IIS
{
Ensure = "Present"
Name = "Web-Mgmt-Service"
}
WindowsFeature Web-Request-Monitor
{
Ensure = "Present"
Name = "Web-Request-Monitor"
}
Service WebManagementService
{
Name = "WMSVC"
StartupType = "Automatic"
State = "Running"
DependsOn = "[WindowsFeature]IIS"
}
WindowsFeature Web-Mgmt-Console
{
Ensure = "Present"
Name = "Web-Mgmt-Console"
}
Registry RemoteManagement
{
Key = "HKLM:\SOFTWARE\Microsoft\WebManagement\Server"
ValueName = "EnableRemoteManagement"
ValueData = 1
ValueType = "Dword"
DependsOn = "[WindowsFeature]IIS"
}
Script NugetPackageProvider
{
SetScript = {Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force}
TestScript = {if ((Get-PackageProvider -listavailable -name nuget -erroraction SilentlyContinue).Count -eq 0) {return $false
} else {return $true
}}
GetScript = {@{Result = "true"}}
}
Script ChocolateyPackageProvider
{
SetScript = {Register-PackageSource -Name chocolatey -ProviderName Chocolatey -Location http://chocolatey.org/api/v2/ -force}
TestScript = {if ((Get-PackageProvider -listavailable -name Chocolatey -erroraction SilentlyContinue).Count -eq 0) {return $false
} else {return $true}}
GetScript = {@{Result = "true"}}
}
Script xWebAdministration
{
SetScript = {Install-Module xWebAdministration}
TestScript = {if ((get-module xwebadminstration -ListAvailable).Count -eq 0){return $false
}else {return $true
}}
GetScript = {@{Result = "true"}}
DependsOn = "[Script]NugetPackageProvider"
}
Script cNtfsAccessControl
{
SetScript = {Install-Module cNtfsAccessControl}
TestScript = {if ((get-module cNtfsAccessControl -ListAvailable).Count -eq 0){return $false
}else {return $true
}}
GetScript = {@{Result = "true"}}
DependsOn = "[Script]NugetPackageProvider"
}
}
}
BasicIIS -OutputPath .\BasicIIS
Start-DscConfiguration -Wait -Verbose -Path .\BasicIIS -Force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment