Friday, January 16, 2015

Powershell DSC

Setting up Pull Server
Download WMF 5.0 to your 2012 VM from:

Open Powershell console and run the following command:

Install-Module xPSDesiredStateConfiguration -MinimumVersion 3.0.1 –Force

Accept the offer to download NuGet_anycpu.exe.
Create and run the following script.
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 server01.comtoso.local
Modules for Dsc Pull server are installed in:












Modules to deploy Dsc Resources are installed in: