====== Windows Server 2012 ======
===== Set static IP =====
New-NetIPAddress -IPAddress 10.0.0.2 -InterfaceAlias "Ethernet" -DefaultGateway 10.0.0.1 -AddressFamily IPv4 -PrefixLength 24
===== Install Active Directory Domain Services (AD DS) and DNS and create a new domain in a new forest =====
Install-WindowsFeature AD-Domain-Services
Install-ADDSForest -DomainName dc-test.sample.com
===== Create a DNS Reverse Lookup Zone =====
Add-DnsServerPrimaryZone 0.0.10.in-addr.arpa -ZoneFile 0.0.10.in-addr.arpa.dns
===== Create a new user account in Active Directory =====
New-ADUser -SamAccountName User1 -AccountPassword (read-host "Set user password" -assecurestring) -name "User1" -enabled $true -PasswordNeverExpires $true -ChangePasswordAtLogon $false
Add-ADPrincipalGroupMembership -Identity "CN=User1,CN=Users,DC=dc-test,DC=sample,DC=com" -MemberOf "CN=Enterprise Admins,CN=Users,DC=dc-test,DC=sample,DC=com","CN=Domain Admins,CN=Users,DC=dc-test,DC=sample,DC=com"
===== Install DHCP role =====
Install-WindowsFeature –Name DHCP
===== Bind DHCP to interface =====
Set-DhcpServerv4Binding -BindingState $true -InterfaceAlias “Local Area Connection”
===== Authorize DHCP server in AD =====
Add-DhcpServerInDC -DnsName “DhcpServer.DomainName.com”
===== Add DHCP scope =====
Add-DhcpServerv4Scope -Name "Friendly Name of Scope" -StartRange 10.10.10.1 -EndRange 10.10.10.254 -SubnetMask 255.255.255.0
===== Set DNS server through DHCP =====
Set-DhcpServerv4OptionValue -OptionId 6 -value 192.168.1.1
----
===== Remove AD DC role =====
Uninstall-ADDSDomainController -LastDomainControllerInDomain –RemoveApplicationPartitions -Force
===== Remove DHCP scope =====
Remove-DhcpServerv4Scope -ScopeId 10.10.10.0 -Force
===== Whitelist MAC in DHCP =====
Add-Dhcpserverv4Filter -List Allow -MacAdress -Description
===== Create DHCP reservation =====
Add-Dhcpserverv4Reservation -ScopeId 10.10.10.0 -IPAdress 10.10.10.123 -ClientiD -Description
===== Allow dynamic DNS update =====
dnscmd /Config {|..AllZones} /AllowUpdate {1|0}