Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. # Install Active Directory Service Role
  2. Install-WindowsFeature -Name 'AD-Domain-Services' -IncludeManagementTools | Out-Null
  3. $RoleCheck = (Get-WindowsFeature -Name 'AD-Domain-Services').InstallState
  4. If ($RoleCheck -eq 'Installed') {
  5. Write-Output `r 'Active Directory Role Installed' `r
  6.  
  7. }
  8.  
  9. # Define Active Directory Domain
  10. $DefineADDomain = Read-Host -Prompt 'Please Enter the Active Directory Domain Service'
  11. $DefineADDnsDomain = $DefineADDomain.Split('.')[1]
  12.  
  13. Write-Output `r "Active Directory FQDN: $DefineADDomain"
  14. Write-Output "Active Directory DNS: $DefineADDnsDomain"
  15.  
  16. # Define Domain Forrest and Mode
  17. $QueryOS = (Get-WmiObject -Class Win32_OperatingSystem).Caption
  18.  
  19.  
  20. If ($QueryOS -clike 'Microsoft Windows Server 2008R2*') {
  21. Write-Output 'Operating System: Microsoft Windows Server 2008R2'
  22. $DomainForest = 'Win2008R2'
  23. $DomainMode = 'Win2008R2'
  24. }
  25.  
  26. If ($QueryOS -clike 'Microsoft Windows Server 2012*') {
  27. Write-Output 'Operating System: Microsoft Windows Server 2012'
  28. $DomainForest = 'Win2012R2'
  29. $DomainMode = 'Win2012R2'
  30. }
  31.  
  32. If ($QueryOS -clike 'Microsoft Windows Server 2016*') {
  33. Write-Output 'Operating System: Microsoft Windows Server 2016'
  34. $DomainForest = 'WinThreshold'
  35. $DomainMode = 'WinThreshold'
  36. }
  37.  
  38.  
  39. If ($QueryOS -clike 'Microsoft Windows Server 2019*') {
  40. Write-Output 'Operating System: Microsoft Windows Server 2019'
  41. $DomainForest = 'WinThreshold'
  42. $DomainMode = 'WinThreshold'
  43. }
  44.  
  45. Write-Output `r 'Configured Active Directory Domain Forest and Mode:'
  46. $DomainForest
  47. $DomainMode
  48.  
  49. Write-Output 'Configuring Domain Serivce Recovery Mode Password [DSRM]:'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement