Insufficient data from Andrew Fryer

The place where I page to when my brain is full up of stuff about the Microsoft platform

Active Directory for Demos

Active Directory for Demos

  • Comments 3
  • Likes

Are you bored setting up domain controllers for your demos to work with, not sure of all the prompts to fill in then try this on a clean copy of Windows Server 2008 R2..

Create a text file called NewDC.txt and copy this into it..

[DCINSTALL]

InstallDNS=Yes

NewDomain=forest10

NewDomainDNSName=Contoso.com

DomainNetBiosName=domain

ForestLevel=3

DomainLevel=3

DatabasePath=%systemroot%\NTDS

Logpath=%systemroot%\LOG

RebootonCompletion=yes

SYSVOLPath=%systemroot%\SYSVOL

SafeModeAdminPassword=

on the last line you’ll want to add your own password to the SafeModeAdminPassword.

Save the file and then enter this command:

DCPROMO /unattend:NewDC.txt

and your done. except you might also want to put some accounts in there.  Powershell is your friend here, and if you need a regular script to do this don’t forget my favourite powershell command:

Set-ExecutionMode unrestricted

which allows you to run any old script  (usually with a .ps1 extension). Here’s a typical script I use..

Import-Module ActiveDirectory
New-ADUser -SamAccountName SQLService -Name "SQLService" -AccountPassword (ConvertTo-SecureString -AsPlainText "Pa55word" -Force) -Enabled $true ,DC=CONTOSO,DC=COM' -PasswordNeverExpires 1
New-ADUser -SamAccountName LabUser -Name "Andrew" -AccountPassword (ConvertTo-SecureString -AsPlainText "Pa55word" -Force) -Enabled $true,DC=CONTOSO,DC=COM' -PasswordNeverExpires 1
Add-ADGroupMember -Identity Administrators -Member SQLService   
Add-ADGroupMember -Identity Administrators -Member Andrew

Enjoy

Comments
  • I wouldnt stick an unrestricted execution policy on a live dc though. Only on something you dont care about :) @paul__iddon

  • Typo - DomainNetBoisName=domain should be DomainNetBiosName=domain - shouldn't it?

    Other than that, thank you - I keep meaning to do this, and never do!

  • David, Thanks for that and I have corrected the post, Andrew

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment