Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Install Active Directory Service Role
- Install-WindowsFeature -Name 'AD-Domain-Services' -IncludeManagementTools | Out-Null
- $RoleCheck = (Get-WindowsFeature -Name 'AD-Domain-Services').InstallState
- If ($RoleCheck -eq 'Installed') {
- Write-Output `r 'Active Directory Role Installed' `r
- }
- # Define Active Directory Domain
- $DefineADDomain = Read-Host -Prompt 'Please Enter the Active Directory Domain Service'
- $DefineADDnsDomain = $DefineADDomain.Split('.')[1]
- Write-Output `r "Active Directory FQDN: $DefineADDomain"
- Write-Output "Active Directory DNS: $DefineADDnsDomain"
- # Define Domain Forrest and Mode
- $QueryOS = (Get-WmiObject -Class Win32_OperatingSystem).Caption
- If ($QueryOS -clike 'Microsoft Windows Server 2008R2*') {
- Write-Output 'Operating System: Microsoft Windows Server 2008R2'
- $DomainForest = 'Win2008R2'
- $DomainMode = 'Win2008R2'
- }
- If ($QueryOS -clike 'Microsoft Windows Server 2012*') {
- Write-Output 'Operating System: Microsoft Windows Server 2012'
- $DomainForest = 'Win2012R2'
- $DomainMode = 'Win2012R2'
- }
- If ($QueryOS -clike 'Microsoft Windows Server 2016*') {
- Write-Output 'Operating System: Microsoft Windows Server 2016'
- $DomainForest = 'WinThreshold'
- $DomainMode = 'WinThreshold'
- }
- If ($QueryOS -clike 'Microsoft Windows Server 2019*') {
- Write-Output 'Operating System: Microsoft Windows Server 2019'
- $DomainForest = 'WinThreshold'
- $DomainMode = 'WinThreshold'
- }
- Write-Output `r 'Configured Active Directory Domain Forest and Mode:'
- $DomainForest
- $DomainMode
- Write-Output 'Configuring Domain Serivce Recovery Mode Password [DSRM]:'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement