Skip to content

Commit

Permalink
DOS-2635: ad powershell fixes (#605)
Browse files Browse the repository at this point in the history
* DSOS-2635: fixes to AD DomainController  powershell

* fix
  • Loading branch information
drobinson-moj authored Mar 11, 2024
1 parent 1425b2a commit 5acddad
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,22 @@ if ($DFSReplicationStatus -eq $null) {
$ADAdminCredential = Get-ModPlatformADAdminCredential -ModPlatformADConfig $ADConfig -ModPlatformADSecret $ADSecret
$ADSafeModeAdministratorPassword = Get-ModPlatformADSafeModeAdministratorPassword -ModPlatformADConfig $ADConfig -ModPlatformADSecret $ADSecret
Install-WindowsFeature -Name AD-Domain-Services -IncludeAllSubFeature -IncludeManagementTools
Install-ADDSDomainController -DomainName $ADConfig.DomainNameFQDN -InstallDns:$true -Credential $ADAdminCredential -SafeModeAdministratorPassword $ADSafeModeAdministratorPassword -NoRebootOnCompletion -Force
Install-ADDSDomainController `
-DomainName $ADConfig.DomainNameFQDN `
-InstallDns:$true `
-Credential $ADAdminCredential `
-SafeModeAdministratorPassword $ADSafeModeAdministratorPassword `
-NoRebootOnCompletion `
-NoGlobalCatalog:$false `
-CreateDnsDelegation:$false `
-CriticalReplicationOnly:$false `
-DatabasePath "C:\Windows\NTDS" `
-LogPath "C:\Windows\NTDS" `
-SysvolPath "C:\Windows\SYSVOL" `
-SiteName "Default-First-Site-Name" `
-Force
Exit 3010 # triggers reboot if running from SSM Doc
} else {
$Services='DNS','DFS Replication','Intersite Messaging','Kerberos Key Distribution Center','NetLogon',Active Directory Domain Services
$Services='DNS','DFS Replication','Intersite Messaging','Kerberos Key Distribution Center','NetLogon','Active Directory Domain Services'
ForEach ($Service in $Services) {Get-Service $Service | Select-Object Name, Status}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ $DFSReplicationStatus = Get-Service "DFS Replication" -ErrorAction SilentlyConti
if ($DFSReplicationStatus -ne $null) {
$ADAdminCredential = Get-ModPlatformADAdminCredential -ModPlatformADConfig $ADConfig -ModPlatformADSecret $ADSecret
$ADSafeModeAdministratorPassword = Get-ModPlatformADSafeModeAdministratorPassword -ModPlatformADConfig $ADConfig -ModPlatformADSecret $ADSecret
Uninstall-ADDSDomainController -Credential $ADAdminCredential -NoRebootOnCompletion -Force
Uninstall-ADDSDomainController -Credential $ADAdminCredential -NoRebootOnCompletion -DemoteOperationMasterRole -ForceRemoval -Force
Exit 3010 # triggers reboot if running from SSM Doc
}

0 comments on commit 5acddad

Please sign in to comment.