Create a new ad forest, Microsoft Article

From MyWiki
Jump to: navigation, search

Reference - https://blogs.technet.microsoft.com/heyscriptingguy/2013/01/03/use-powershell-to-deploy-a-new-active-directory-forest/
Configure the dns server using Powershell:
Set-DNSClientServerAddress -interfaceIndex 12 -ServerAddresses ("192.168.0.1","8.8.8.8")
Set-DnsClientServerAddress -InterfaceAlias “Wired Ethernet Connection” -ServerAddresses 192.168.0.1, 192.168.0.2  ??
Change ip address:
New-NetIPAddress –InterfaceAlias “Ethernet” –IPAddress “192.168.0.33” –PrefixLength 24 -DefaultGateway 192.168.0.1 - no good
Get adapter details:
Get-Netadapter
Removing ip addresses:
https://docs.microsoft.com/en-us/powershell/module/nettcpip/remove-netipaddress?view=win10-ps

Getting the ip address:
Get-Netipaddress -interfaceindex 12 | select Ipaddress

An example of getting the current ip address:
$ipaddress = $(ipconfig | where {$_ -match 'IPv4.+\s(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})' } | out-null; $Matches[1])