Professional Documents
Culture Documents
com/2014/12/install-windows-ad/
≡ Menu
Home
Free eBook
Start Here
Contact
About
J’aime 62 Tweet
As a Linux Sysadmin, you might still find yourself managing few Windows Servers.
In those situations, instead of using the Windows GUI for administration, you might find it interesting to install and configure Windows Services from
command line.
In this tutorial, we’ll explain how to install AD (Active Directory) on Windows 2012 Core Servers using the following command line utilities.
install-windowsfeature
import-module
install-addsforest
There are two high-level steps to install AD. First, install the AD itself. Second, promote the server as domain controller.
You can install AD from server manager GUI interface as we explained earlier. But, if you are Linux sysadmin, you might find it interesting to use the
command line utilities instead of GUI.
To begin the AD installation from the command line, we need to know the exact name of the Active Directory Service that we should install.
This will list all windows server features as shown below. As you see from this list, the AD service name is “AD-domain-services”.
To install Active Directory from the command line, use the “install-windowsfeature” command as shown below.
C:\> Install-windowsfeature AD-domain-services
This command will extract all required binary files and start the AD installation.
After completing the Active Directory installation, it will display the result in a table format as shown below.
To increase the server performance all modules and commands are not loaded by default in the server. We have to import the modules as per our requirement.
To continue our AD installation and configuration, we need ADDSDeployment module. Import this module as shown below using import-module
powershell command.
C:\> Import-Module ADDSDeployment
Next, promote your server as Domain controller based on your requirement using any one of the following commands.
Command Description
Add-ADDSReadOnlyDomainControllerAccount Install read only domain controller
Install-ADDSDomain Install first domain controller in a child or tree domain
Install-ADDSDomainController Install additional domain controller in domain
Install-ADDSForest Install first domain controller in new forest
Test-ADDSDomainControllerInstallation Verify prerequisites to install additional domain controller in domain
Test-ADDSDomainControllerUninstallation Uninstall AD service from server
Test-ADDSDomainInstallation Verify prerequisites to install first domain controller in a child or tree domain
Test-ADDSForestInstallation Install first domain controller in new forest
Test-ADDSReadOnlyDomainControllerAccountCreation Verify prerequisites to install Read only domain controller
Uninstall-ADDSDomainController Uninstall the domain contoller from server
To install the Active directory with default configuration, execute “Install-AddsForest” command:
C:\> Install-AddsForest
To install the Active directory with customized options, pass the appropropriate parameters as shown below. IN this example, we are setting several
configuration parameters for our AD including the DomainName.
C:\> Install-ADDSForest
-CreateDnsDelegation:$false `
-DatabasePath "C:\Windows\NTDS" `
-DomainMode "Win2012R2" `
-DomainName "thegeekstuff.com" `
-DomainNetbiosName "THEGEEKSTUFF" `
-ForestMode "Win2012R2" `
-InstallDns:$true `
-LogPath "C:\Windows\NTDS" `
-NoRebootOnCompletion:$false `
-SysvolPath "C:\Windows\SYSVOL" `
-Force:$true
Finally, this will prompt for SafeModeAdministratorPassword. This password is for the Directory Services Restore Mode (DSRM).
Set your DSRM password here, which will finish the AD installation and configuration on your Windows Server using the command line utilities.
Tagged as: Get-WindowsFeature Installed, Import-Module Active Directory, Install-AddsForest, Install-AddsForest DomainName, Install-AddsForest
Example, Install-AddsForest Script, Install-WindowsFeature Active Directory, Install-WindowsFeature AD-domain-services,
SafeModeAdministratorPassword
Link
Arun December 12, 2014, 3:26 am
I am using Windows XP and I installed powershell . But the command get-windowsfeature didn’t get wored . Idon’t know why ?
Link
satheesh December 20, 2014, 6:00 am
Hi Ram,
In windows you can run the commands in all directory, So I ran commands in my home directory, but it will install in “C:\windows”.
Quetion
Link
Anthony Datu December 20, 2014, 3:48 pm
Hi Ramesh,
My question might be off topic, but do you happen to know if DBI-LDAP module works in Active Directory?
Thanks,
Anthony
Link
Matthias June 6, 2015, 6:15 am
Hello,
if i entered the command i will aksed after the DSRM Password. If i had entered the first and press enter i get an error message “no positionparameter
to accept SafeModeAdministratorPassword”.
Link
Leave a Comment
Name
Website
Comment
Previous post: How to Setup Logstash on Linux with ElasticSearch, Redis, Nginx
Search
EBOOKS
Linux 101 Hacks 2nd Edition eBook - Practical Examples to Build a Strong Foundation in Linux
Bash 101 Hacks eBook - Take Control of Your Bash Command Line and Shell Scripting
Sed and Awk 101 Hacks eBook - Enhance Your UNIX / Linux Life with Sed and Awk
Vim 101 Hacks eBook - Practical Examples for Becoming Fast and Productive in Vim Editor
Nagios Core 3 eBook - Monitor Everything, Be Proactive, and Sleep Well
POPULAR POSTS
CATEGORIES
Linux Tutorials
Vim Editor
Sed Scripting
Awk Scripting
Bash Shell Scripting
Nagios Monitoring
OpenSSH
IPTables Firewall
Apache Web Server
MySQL Database
Perl Programming
Google Tutorials
Ubuntu Tutorials
PostgreSQL DB
Hello World Examples
C Programming
C++ Programming
DELL Server Tutorials
Oracle Database
VMware Tutorials
My name is Ramesh Natarajan. I will be posting instruction guides, how-to, troubleshooting tips and tricks on Linux, database, hardware,
security and web. My focus is to write articles that will either teach you or help you resolve a problem. Read more about Ramesh Natarajan and the blog.
Contact Us
Email Me : Use this Contact Form to get in touch me with your comments, questions or suggestions about this site. You can also simply drop me a line to
say hello!.
Follow us on Google+
Follow us on Twitter
Support Us