Skip to content

Instantly share code, notes, and snippets.

@florianbeisel
Last active August 29, 2015 14:16
Show Gist options
  • Save florianbeisel/9274522bc2ea19d41f6e to your computer and use it in GitHub Desktop.
Save florianbeisel/9274522bc2ea19d41f6e to your computer and use it in GitHub Desktop.
configuration ConfigureDSCClient
{
param ($NodeId, $PullServer)
LocalConfigurationManager
{
AllowModuleOverwrite = 'True'
ConfigurationID = $NodeId
ConfigurationModeFrequencyMins = 60
ConfigurationMode = 'ApplyAndAutoCorrect'
RebootNodeIfNeeded = 'True'
RefreshMode = 'PULL'
DownloadManagerName = 'WebDownloadManager'
DownloadManagerCustomData = (@{ServerUrl = "https://$PullServer/psdscpullserver.svc"})
}
}
#ContosoWebsite.ps1
Configuration ContosoWebsite
{
param ($MachineName)
Node $MachineName
{
#Install the IIS Role
WindowsFeature IIS
{
Ensure = "Present"
Name = "Web-Server"
}
#Install ASP.NET 4.5
WindowsFeature ASP
{
Ensure = "Present"
Name = "Web-Asp-Net45"
}
}
}
#ContosoWebsite –MachineName "server2.contoso.com"
#NewPullServer.ps1
configuration NewPullServer
{
param
(
[string[]]$ComputerName = 'localhost'
)
Import-DSCResource -ModuleName xPSDesiredStateConfiguration
Node $ComputerName
{
WindowsFeature DSCServiceFeature
{
Ensure = "Present"
Name = "DSC-Service"
}
xDscWebService PSDSCPullServer
{
Ensure = "Present"
EndpointName = "PSDSCPullServer"
Port = 8080
PhysicalPath = "$env:SystemDrive\inetpub\wwwroot\PSDSCPullServer"
CertificateThumbPrint = "AllowUnencryptedTraffic"
ModulePath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules"
ConfigurationPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration"
State = "Started"
DependsOn = "[WindowsFeature]DSCServiceFeature"
}
xDscWebService PSDSCComplianceServer
{
Ensure = "Present"
EndpointName = "PSDSCComplianceServer"
Port = 9080
PhysicalPath = "$env:SystemDrive\inetpub\wwwroot\PSDSCComplianceServer"
CertificateThumbPrint = "AllowUnencryptedTraffic"
State = "Started"
IsComplianceServer = $true
DependsOn = ("[WindowsFeature]DSCServiceFeature","[xDSCWebService]PSDSCPullServer")
}
}
}
#This line actually calls the function above to create the MOF file.
#NewPullServer –ComputerName server1.contoso.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment