-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCreate1stCoreFamDC_Remote.ps1
More file actions
44 lines (39 loc) · 1.43 KB
/
Create1stCoreFamDC_Remote.ps1
File metadata and controls
44 lines (39 loc) · 1.43 KB
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
# Variables
Param(
[Parameter(Mandatory=$true,
ParameterSetName="DomainNameFQDN")]
[string[]]
$domainname,
[Parameter(Mandatory=$true,
ParameterSetName="SafeModePassword")]
[string[]]
$SafeModePassword,
)
# Configure Data Disk
Initialize-Disk 2 -Confirm:$false
new-partition -disknumber 2 -usemaximumsize -DriveLetter S | format-volume -filesystem NTFS -newfilesystemlabel SYSVOL -Force -Confirm:$false
#Install AD DS, DNS and GPMC
$featureLogPath = "c:\featurelog.txt"
start-job -Name addFeature -ScriptBlock {
Add-WindowsFeature -Name "ad-domain-services" -IncludeAllSubFeature -IncludeManagementTools
Add-WindowsFeature -Name "dns" -IncludeAllSubFeature -IncludeManagementTools
Add-WindowsFeature -Name "gpmc" -IncludeAllSubFeature -IncludeManagementTools }
Wait-Job -Name addFeature
Get-WindowsFeature | Where installed >>$featureLogPath
# Create New Forest, add Domain Controller
#$SafeModePassword = ConvertTo-SecureString "P@ssw0rd12345" -AsPlainText -Force
#$domainname = "lab.corefamily.net"
$netbiosName = $domainname.split(".")[0]
Import-Module ADDSDeployment
Install-ADDSForest -CreateDnsDelegation:$false `
-DatabasePath "S:\Windows\NTDS" `
-DomainMode 7 `
-DomainName $domainname `
-DomainNetbiosName $netbiosName `
-ForestMode 7 `
-InstallDns:$true `
-LogPath "S:\Windows\NTDS" `
-NoRebootOnCompletion:$false `
-SysvolPath "S:\Windows\SYSVOL" `
-SafeModeAdministratorPassword $SafeModePassword `
-Force:$true