Skip to content

Instantly share code, notes, and snippets.

@duffney
Last active December 14, 2015 20:53
Show Gist options
  • Save duffney/54fbdc57076835c34a19 to your computer and use it in GitHub Desktop.
Save duffney/54fbdc57076835c34a19 to your computer and use it in GitHub Desktop.
Configuration CertificateAuthority
{
Import-DscResource -ModuleName xAdcsDeployment,PSDesiredStateConfiguration,xNetworking,xComputerManagement,xTimeZone
Node $AllNodes.Where{$_.Role -eq "PKI"}.Nodename
{
xTimeZone SystemTimeZone {
TimeZone = 'Central Standard Time'
IsSingleInstance = 'Yes'
}
xIPAddress NewIPAddress
{
IPAddress = $Node.IPAddress
InterfaceAlias = "Ethernet"
SubnetMask = 24
AddressFamily = "IPV4"
}
xDefaultGatewayAddress NewDefaultGateway
{
AddressFamily = 'IPv4'
InterfaceAlias = 'Ethernet'
Address = $Node.DefaultGateway
DependsOn = '[xIPAddress]NewIpAddress'
}
WindowsFeature ADCS-Cert-Authority
{
Ensure = 'Present'
Name = 'ADCS-Cert-Authority'
}
xADCSCertificationAuthority ADCS
{
Ensure = 'Present'
Credential = $Node.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'
Name = 'CertSrv'
Credential = $Node.Credential
DependsOn = '[WindowsFeature]ADCS-Web-Enrollment','[xADCSCertificationAuthority]ADCS'
}
}
}
$ConfigData = @{
AllNodes = @(
@{
Nodename = 'S2'
Role = "PKI"
PsDscAllowPlainTextPassword = $true
PSDscAllowDomainUser = $true
IPAddress = '192.168.2.4'
Credential = (Get-Credential -UserName 'source\administrator' -Message 'cred')
DefaultGateway = '192.168.2.1'
}
)
}
#Generates .mof file to be pushed
CertificateAuthority -ConfigurationData $ConfigData
#Pushes the .mof to the remote system to make it so
Start-DscConfiguration -ComputerName S2 -Wait -Force -Path C:\DSC\CertificateAuthority\ -Verbose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment