Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<#
.SYNOPSIS
This script will install an AD integrated certificate authority with web enrollment in your lab
.NOTES
You need a Windows Server 2012 R2 for this script to work.
This script is part of a series to automate your lab on www.dominikbritz.com
#>
#Requires -Version 3
#Requires -RunAsAdministrator
###
### Variables
###
$CACommonName = 'dominik-lab-CA'
$HashAlgorithmName = 'SHA256'
$KeyLength = 2048
$PeriodOfValidity = 5 #in years
###
### Script
###
Try
{
Install-WindowsFeature -Name AD-Certificate -IncludeManagementTools
Install-AdcsCertificationAuthority -HashAlgorithmName SHA256 -KeyLength $KeyLength -ValidityPeriod Years -ValidityPeriodUnits $PeriodOfValidity -CACommonName $CACommonName -CAType EnterpriseRootCA -Verbose -Force
Add-WindowsFeature ADCS-Web-Enrollment
Install-AdcsWebEnrollment -Force
}
Catch
{
Throw $_
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.