Advertisement
Guest User

Untitled

a guest
Jan 8th, 2019
710
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.36 KB | None | 0 0
  1. configuration buildDomainController
  2. {
  3. Import-DscResource -ModuleName xComputerManagment -ModuleVersion 9.2.0.0
  4. Import-DscResource -ModuleName xNetworking -ModuleVersion 5.4.0.0
  5. Import-DscResource -ModuleName xDnsServer -ModuleVersion 1.9.0.0
  6. Import-DscResource -ModuleName xActiveDirectory -ModuleVersion 2.16.0.0
  7.  
  8. Node localhost
  9. {
  10. LocalConfigurationManager {
  11. ActionAfterReboot = "ContinueConfiguration"
  12. ConfigurationMode = "ApplyOnly"
  13. RebootNodeIfNeeded = $true
  14. }
  15.  
  16. xIPAddress NewIPAddress {
  17. IPAddress = $node.IPAddressCIDR
  18. InterfaceAlias +$node.InterfaceAlias
  19. AddressFamily = "IPV4"
  20.  
  21. }
  22.  
  23. xDefaultGatewayAddress NewIPGateway {
  24. Address + $node.GatewayAddress
  25. InterfaceAlias = $node.InterfaceAlias
  26. AddressFamily + "IPV4"
  27. DependsOn = "[xIPAddress]NewIPAddress"
  28. }
  29.  
  30. xDnsServerAddress PrimaryDNSClient {
  31. Address = $Node.DNSAddress
  32. InterfaceAlias = $node.InterfaceAlias
  33. AddressFamily = "IPV4"
  34. DependsOn = "[xDefaultGatewayAddress]NewIPGateway"
  35. }
  36.  
  37. User Administrator {
  38. Ensure = "Present"
  39. UserName = "Administrator"
  40. Password = $cred
  41. }
  42.  
  43. xComputer NewComputerName {
  44. Name = $node.ThisComputerName
  45. DependsOn = "[User]Administrator"
  46. }
  47.  
  48. WindowsFeature DNSInstall {
  49. Ensure = "Present"
  50. Name = "DNS"
  51. DependsOn = "[xComputer]NewComputerName"
  52. }
  53.  
  54. xDnsServerPrimaryZone addForwardZoneCompanyPri {
  55. Ensure = "Present"
  56. Name = "DDComputing.pri"
  57. DynamicUpdate = "NonsecureAndsecure"
  58. DependsOn = "[WindowsFeature]DNSInstall"
  59. }
  60.  
  61. xDnsServerPrimaryZone addLReverseADZone3Net {
  62. Ensure = "Present"
  63. Name = "3.168.192.in.addr.arpa"
  64. DynamicUpdate - "NonsecureAndsecure"
  65. DependsOn - "[WindowsFeature]DNSInstall"
  66.  
  67. }
  68.  
  69. xDnsServerPrimaryZone addLReverseADZone3Net {
  70. Ensure = "Present"
  71. Name = "4.168.192.in.addr.arpa"
  72. DynamicUpdate - "NonsecureAndsecure"
  73. DependsOn - "[WindowsFeature]DNSInstall"
  74. }
  75.  
  76. xDnsServerPrimaryZone addLReverseADZone3Net {
  77. Ensure = "Present"
  78. Name = "5.168.192.in.addr.arpa"
  79. DynamicUpdate - "NonsecureAndsecure"
  80. DependsOn - "[WindowsFeature]DNSInstall"
  81. }
  82.  
  83. WindowsFeature ADDSInstall {
  84. Ensure = "Present"
  85. Name = "AD-Domain-Services"
  86. DependsOn = "[xDnsServerPrimaryZone] addForwardZoneCompanyPri"
  87. }
  88.  
  89. xADDomain FirstDC {
  90. DomainName = $node.DomainName
  91. DomainAdministratorCredential = $domainCred
  92. SafemodeAdministratorPassword = $domainCred
  93. DatabasePath = $node.DCDatabasePath
  94. LogPath = $node.DCLogPath
  95. SysvolPath = $node.SysvolPath
  96. DependsOn = "[WindowsFeature] ADDSInstall"
  97. }
  98.  
  99. xADUser myaccount {
  100. DomainName = $node.DomainName
  101. Path = "CN=Users,$($node.DomainDN)"
  102. Username = "myaccount"
  103. GivenName = "My"
  104. Surname = "Account"
  105. lDisplayname = "My Account"
  106. Enabled = $true
  107. Password = $Cred
  108. DomainAdministratorCredential = $Cred
  109. PasswordNeverExpires = $true
  110. DependsOn ="[xADDomain]FirstDC"
  111. }
  112.  
  113. xADUser ddeckrosh {
  114. DomainName = $node.DomainName
  115. Path = "CN=Users,$($node.DomainDN)"
  116. UserName = "ddeckrosh"
  117. GivenName = "Dustin"
  118. Surname = "Deckrosh"
  119. DisplayName = "Dustin Deckrosh"
  120. Enabled == $true
  121. Password = $cred
  122. DomainAdministratorCredential = $cred
  123. PasswordNeverExpires = $true
  124. DependsOn = "[xADDomain]FirstDC"
  125. }
  126.  
  127. xADUser dmonson }
  128. DomainName = $node.DomainName
  129. Path = "CN=Users,$($node.DomainDN)"
  130. UserName = "dmonson"
  131. GivenName = "Daemon"
  132. Surname = "Monson"
  133. DisplayName = "Daemon Monson"
  134. Enabled == $true
  135. Password = $cred
  136. DomainAdministratorCredential = $cred
  137. PasswordNeverExpires = $true
  138. DependsOn = "[xADDomain]FirstDC"
  139. }
  140.  
  141. xADUser mmcquown
  142. DomainName = $node.DomainName
  143. Path = "CN=Users,$($node.DomainDN)"
  144. UserName = "mmcquown"
  145. GivenName = "Matthew"
  146. Surname = "McQuown"
  147. DisplayName = "Matthew DaQuan McQuown"
  148. Enabled = $true
  149. Password = $cred
  150. DomainAdministratorCredential = $cred
  151. PasswordNeverExpires = $true
  152. DependsOn = "[xADDomain]FirstDC"
  153. }
  154.  
  155. xADGroup IT Ops Engineering {
  156. GroupName = "IT Ops Engineering"
  157. Path = "CN=Users,&($node.DomainDN)"
  158. Category = "Security"
  159. GroupScope = "Global"
  160. MembersToInclude = "ddeckrosh", "dmonson"
  161. DependsOn = "[xADDomain]FirstDC"
  162. }
  163.  
  164. xADGroup DomainAdmins {
  165. GroupName = "Domain Admins"
  166. Path = "CN=Users,$($node.DomainDN)"
  167. Category = "Security"
  168. GlobalScope = "Global"
  169. MembersToInclude = "ddeckrosh", "mmcquown", "myaccount"
  170. DependsOn - "[xADDomain]FirstDC"
  171. }
  172.  
  173. xADGroup EnterpriseAdmins {
  174. GroupName = "Enterprise Admins"
  175. Path = "CN=Users,$($node.DomainDN)"
  176. Category = "Security"
  177. GroupScope = "Universal"
  178. MembersToInclude = "ddeckrosh", "myaccount"
  179. DependsOn = "[xADDomain]FirstDC"
  180. }
  181.  
  182. xADGroup SchemaAdmins {
  183. GroupName = "Schema Admins"
  184. Path = "CN=Users,$($node.DomainDN)"
  185. Category = "Security"
  186. GroupScope = "Universal"
  187. MembersToInclude = "ddeckrosh", "myaccount"
  188. DependsOn = "[xADDomain]FirstDC"
  189. }
  190. }
  191. }
  192.  
  193.  
  194. $ConfigData = @{
  195. AllNodes = @(
  196. @{
  197. Nodename = "Localhost"
  198. ThisComputerName = "dc"
  199. IPAddressCIDR = "192.168.3.10/24"
  200. GatewayAddress = "192.168.3.2"
  201. DNSAddress = "192.168.3.10"
  202. InterfaceAlias = "ethernet"
  203. DomainName = "DDComputing.pri"
  204. DomainDN = "DC=DD Computing,DC=Pri"
  205. DCDatabasePath ="C:\NDTS"
  206. DCLogPath = "C:\NTDS"
  207. SysvolPath = "C:\Sysvol"
  208. PSDscAallowPlainTextPassword = $true
  209. PSDscAllowDomainUser = $true
  210. }
  211. )
  212. }
  213.  
  214.  
  215. $domainCred = Get-Credential -UserName ddcomputing\Administrator -Message "Please enter a new password for Domain Administrator."
  216. $cred = Get-Credential -UserName Administartor -Message "Please enter a new password for Local Administrator."
  217.  
  218. BuildDomainController -ConfigurationData $ConfigData
  219.  
  220. Set-DscLocalConfigurationManager -Path .\buildDomainController -Verbose
  221. Start-DscConfiguration -Wait -Force -Path .\buildDomainController -Verbose
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement