Freigeben über


Active Directory for Demos

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

  • Anonymous
    December 23, 2010
    The comment has been removed

  • Anonymous
    December 23, 2010
    Typo - DomainNetBoisName=domain should be DomainNetBiosName=domain - shouldn't it? Other than that, thank you - I keep meaning to do this, and never do!

  • Anonymous
    January 03, 2011
    David, Thanks for that and I have corrected the post, Andrew