forked from dsccommunity/ActiveDirectoryDsc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
2-ADDomain_NewChildDomain_Config.ps1
66 lines (58 loc) · 1.91 KB
/
2-ADDomain_NewChildDomain_Config.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<#PSScriptInfo
.VERSION 1.0.1
.GUID 40a01066-4c01-4115-b7a8-c21b51ac4ed3
.AUTHOR DSC Community
.COMPANYNAME DSC Community
.COPYRIGHT DSC Community contributors. All rights reserved.
.TAGS DSCConfiguration
.LICENSEURI https://github.com/dsccommunity/ActiveDirectoryDsc/blob/main/LICENSE
.PROJECTURI https://github.com/dsccommunity/ActiveDirectoryDsc
.ICONURI https://dsccommunity.org/images/DSC_Logo_300p.png
.RELEASENOTES
Updated author, copyright notice, and URLs.
#>
#Requires -Module ActiveDirectoryDsc
<#
.DESCRIPTION
This configuration will create a new child domain in an existing forest with
a Domain Functional Level of Windows Server 2016 (WinThreshold).
The credential parameter must contain the domain qualified credentials of a
user in the forest who has permissions to create a new child domain.
#>
Configuration ADDomain_NewChildDomain_Config
{
param
(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.PSCredential]
$Credential,
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.PSCredential]
$SafeModePassword
)
Import-DscResource -ModuleName PSDesiredStateConfiguration
Import-DscResource -ModuleName ActiveDirectoryDsc
node 'localhost'
{
WindowsFeature 'ADDS'
{
Name = 'AD-Domain-Services'
Ensure = 'Present'
}
WindowsFeature 'RSAT'
{
Name = 'RSAT-AD-PowerShell'
Ensure = 'Present'
}
ADDomain 'child'
{
DomainName = 'child'
Credential = $Credential
SafemodeAdministratorPassword = $SafeModePassword
DomainMode = 'WinThreshold'
ParentDomainName = 'contoso.com'
}
}
}