Skip to content

Instantly share code, notes, and snippets.

@quanghiem
Last active February 4, 2016 16:56
Show Gist options
  • Save quanghiem/3c3aef05a4a303c81450 to your computer and use it in GitHub Desktop.
Save quanghiem/3c3aef05a4a303c81450 to your computer and use it in GitHub Desktop.
DSC NewPullServer
# http://www.systemcentercentral.com/day-1-intro-to-powershell-dsc-and-configuring-your-first-pull-server/
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