Last active
November 28, 2017 18:54
-
-
Save duffney/d62d05b3fd42b4308014bae8c586e184 to your computer and use it in GitHub Desktop.
Pull server lab DSC config for lability sets up AD domain and ADCS.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Configuration Pull { | |
param ( | |
[Parameter()] [ValidateNotNull()] [PSCredential] $Credential = (Get-Credential -Credential 'Administrator') | |
) | |
Import-DscResource -Module PSDesiredStateConfiguration | |
Import-DscResource -Module xActiveDirectory | |
Import-DscResource -Module xPSDesiredStateConfiguration | |
Import-DscResource -Module xAdcsDeployment | |
node $AllNodes.Where({$true}).NodeName { | |
LocalConfigurationManager { | |
RebootNodeIfNeeded = $true; | |
AllowModuleOverwrite = $true; | |
ConfigurationMode = 'ApplyOnly'; | |
} | |
WindowsFeature ADDSTools | |
{ | |
Ensure = "Present" | |
Name = "RSAT-ADDS" | |
} | |
File ADFiles | |
{ | |
DestinationPath = 'C:\NTDS' | |
Type = 'Directory' | |
Ensure = 'Present' | |
} | |
WindowsFeature ADDSInstall | |
{ | |
Ensure = "Present" | |
Name = "AD-Domain-Services" | |
IncludeAllSubFeature = $true | |
} | |
xADDomain FirstDS | |
{ | |
DomainName = $Node.DomainName | |
DomainAdministratorCredential = $Credential | |
SafemodeAdministratorPassword = $Credential | |
DatabasePath = 'C:\NTDS' | |
LogPath = 'C:\NTDS' | |
DependsOn = "[WindowsFeature]ADDSInstall","[File]ADFiles" | |
} | |
WindowsFeature ADCS-Cert-Authority | |
{ | |
Ensure = 'Present' | |
Name = 'ADCS-Cert-Authority' | |
} | |
WindowsFeature ADCSmgmt { | |
Name = 'RSAT-ADCS' | |
IncludeAllSubFeature = $true | |
} | |
WindowsFeature WebConsole { | |
Name = 'Web-Mgmt-Console' | |
Ensure = 'Present' | |
} | |
xADCSCertificationAuthority ADCS | |
{ | |
Ensure = 'Present' | |
Credential = $Credential | |
CAType = 'EnterpriseRootCA' | |
DependsOn = '[WindowsFeature]ADCS-Cert-Authority' | |
} | |
WindowsFeature ADCS-Web-Enrollment | |
{ | |
Ensure = 'Present' | |
Name = 'ADCS-Web-Enrollment' | |
DependsOn = '[WindowsFeature]ADCS-Cert-Authority' | |
} | |
xADCSWebEnrollment CertSrv | |
{ | |
Ensure = 'Present' | |
CAConfig = 'CertSrv' | |
IsSingleInstance = 'Yes' | |
Credential = $Credential | |
DependsOn = '[WindowsFeature]ADCS-Web-Enrollment','[xADCSCertificationAuthority]ADCS' | |
} | |
} | |
} #end Configuration Example |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Greetings,
I forked your GIST but cannot send a pull request. My fork is here: https://gist.github.com/frankiem-4/ab4d01a2cefbd66cad0ab67d42f2eac7#file-dscpullserverlab-ps1
The line "Import-DscResource -Module PSDesiredStateConfiguration, xActiveDirectory, xPSDesiredStateConfiguration, xAdcsDeployment;" needs to be changed to:
I'm not sure why your single line won't work correctly, but something changed within Powershell. Many users have powershell bugs open for this same problem. This is a workaround that should be backwards compatible.