top of page

Install AD DS, DNS and DHCP on windows server 2016

#To start open up powershell in elevated mode and run as administrator, this command will display the name of the feature and is availability. - you will have to make the proper changes to reflect your domain.

 

get-windowsfeature

 

#To install an individual feature, look up google for more details, I am just providing you the road map to follow.

 

Install-WindowsFeature -Name [feature_name] -[Options]

​

# Installing AD role

 

Install-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools

 

# To view the available module commands related to AD DS use the following.

 

Get-Command -Module ADDSDeployment

 

#First make sure the root domain is installed, you may see several error messages and it is okay, once you see the banner "you are about to #be signed out" -the server will restart.

 

Install-ADDSForest -DomainName "corp.company.com"

 

#check the changes took effect, see if you can join any of your lab computers to the domain!

 

Get-ADDomain

 

#To view the client on you windows server DC.

 

get-ADComputer | Format-Table DNSHostName, Enabled, Name, SamAccountName

 

#Add user to AD domain with the following command.

 

New-ADUser -Name username -AccountPassword(Read-Host -AsSecureString AccountPassword) -PassThru | Enable-ADAccount

 

 

#view DNS roles installed

 

Get-windowsFeature | where {($_.name -like "DNS")}

 

#if DNS is not installed, do the following

 

Install-WindowsFeature DNS -IncludeManagementTools

 

#The DNS primary zone is created when the forest is generated, to add primary zone (note: lookup DNS zones), sample below:

 

Add-DnsServerPrimaryZone -NetworkID 192.168.0.0/24 -ZoneFile "192.168.0.0.in-addr.arpa.dns"

 

#now the forwarder, now the one below you can use if you are using a home lab.

 

Add-DnsServerForwarder -IPAddress 8.8.8.8 -PassThru

 

# test the dns server

 

Test-DnsServer -IPAdrress 192.168.0.0 -ZoneName "corp.company.com"

 

#Installing DHCP role, to do it, the windows 2016 server must be configured with a static IP address.
#check the index on the interface (Get-NetAdapter -Name "*")

 

New-NetIPAddress -InterfaceIndex 2 -IPAddress 0.0.0.0 -PrefixLength 24 -DefaultGateway 192.168.0.0

 

#Once the server has been configured with an IP address, you can install the DHCP role.

 

install-windowsFeature DHCP -IncludeManagementTools

 

#add security group with the netsh command, the DHCP administrators and DHCP Users security groups will be created in Local users and #Groups -on the DHCP server.

​

netsh dhcp add securitygroups

 

#create subnets, scope and exclusions. configure the DHCP scope for the domain, these are the addresses that will be handed out to the #network - by DHCP. example below.

 

Add-DHCPServerv4Scope -Name “Employee Scope” -Start Range 192.168.0.0 -EndRange 192.168.0.30 -SubnetMask 255.255.255.0 -State Active

 

#you can set the lease for whatever days you want, below is a sample for 1 day.

 

Set-DhcpServerv4Scope -ScopeId 192.168.64.0 -LeaseDuration 1.00:00:00

 

#Now authorize the server to operate in the domain, DnsServer: you have to put your DNS server IP address, below is a sample only

 

Set-DHCPServerv4OptionValue -ScopeID 192.168.0.0 -DnsDomain corp.company.com -DnsServer 0.0.0.0 -Router 192.168.64.1 # sample

​

#Add DHCP to the Domain Controller

 

Add-DhcpServerInDC -DnsName corp.company.com -IpAddress 192.168.0.0 #your DNS IP address

 

#Now to verify the scope

 

Get-DhcpServerv4Scope

 

#In your DC verify the existence of the DHCP server

 

Get-DhcpServerv4Scope

 

#restart the DHCP service

 

restart-service dhcpserver

 

#On the client machine release and renew the IP to see your dhcp at work

 

ipconfig /release
ipconfig /renew

​

​

​

  • Facebook - Black Circle
  • Twitter - Black Circle

© 2023 by IT SERVICES.  Proudly created with Wix.com

bottom of page