Powershell DSC
OverView
Powershell DSC Overview on Github
Pull Server
Pull Server HTTPS Setup
- Pre-Requisites that need to be installed
- Powershell / WMF 5.0
- IIS Server Role
- This will be installed with the DSC Service as a prerequisite.
- DSC Service
Add-WebFeature DSC-Service
this should also install the required IIS roles.- Like the IIS Roles this can be configured with the DSC Script to create the pull server
- You will also need an Certificate so the web server will run with SSL
Install-Module xPSDisiredConfiguration,xWebAdministration
- These will be used to configure the DSC Pull Server
- Powershell v5.0 includes this cmdlet that can directly download and install powershell modules from an nonline gallery. https://technet.microsoft.com/en-us/library/dn807162.aspx
- https://github.com/PowerShell/xPSDesiredStateConfiguration
- Edit for your environment and run the following script
configuration Sample_xDscWebServiceRegistration
{
param
(
[string[]]$NodeName = 'localhost',
[ValidateNotNullOrEmpty()]
[string] $certificateThumbPrint,
[Parameter(HelpMessage='This should be a string with enough entropy (randomness) to protect the registration of clients to the pull server. We will use new GUID by default.')]
[ValidateNotNullOrEmpty()]
[string] $RegistrationKey # A guid that clients use to initiate conversation with pull server
)
Import-DSCResource -ModuleName xPSDesiredStateConfiguration
Node $NodeName
{
WindowsFeature DSCServiceFeature
{
Ensure = "Present"
Name = "DSC-Service"
}
xDscWebService PSDSCPullServer
{
Ensure = "Present"
EndpointName = "PSDSCPullServer"
Port = 4433
PhysicalPath = "$env:SystemDrive\inetpub\wwwroot\PSDSCPullServer"
CertificateThumbPrint = $certificateThumbPrint
ModulePath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules"
ConfigurationPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration"
State = "Started"
DependsOn = "[WindowsFeature]DSCServiceFeature"
RegistrationKeyPath = "$env:PROGRAMFILES\WindowsPowerShell\DscService"
AcceptSelfSignedCertificates = $true
}
File RegistrationKeyFile
{
Ensure = 'Present'
Type = 'File'
DestinationPath = "$env:ProgramFiles\WindowsPowerShell\DscService\RegistrationKeys.txt"
Contents = $RegistrationKey
}
}
}
DSCWebPullServer -RegistrationKey $RegistrationKey -certificateThumbPrint $CertThumbprint
-
The Registration key is a GUID. Run the following to get a new guid '[GUID]::NewGuid()'
- Push the configuration to your DSC Pull Server
Start-dscConfiguration -Computername FQDN -Path .mof -verbose -wait -force