Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### script made by Michel Belanger###
- ##get the interfaceindex of ethernet card
- $interfaceIndex = Get-NetAdapter -Name ethernet | select -ExpandProperty interfaceindex
- ##Get the ipv4 address of the ethernet card##
- $serverip = Get-NetIPAddress -InterfaceIndex $interfaceIndex | select -ExpandProperty ipv4address
- ## reset the dns interface set by default after installing adds
- Set-dnsclientserveraddress -interfaceindex $interfaceIndex -ResetServerAddresses
- ## set the new dns interface index
- Set-dnsclientserveraddress -interfaceindex $interfaceIndex -serveraddresses $serverip
- ##split ip server ipaddress to get the reverse zone##
- $splitserver = $serverip.Split(".")
- $Reverse = $splitserver[2] + "." + $splitserver[1] + "." + $splitserver[0] + ".in-addr.arpa"
- $ReverseDns = $splitserver[2] + "." + $splitserver[1] + "." + $splitserver[0] + ".in-addr.arpa.dns"
- Add-DnsServerPrimaryZone $Reverse -zonefile $ReverseDns
- ##add ptr record to reverse lookup zone##
- $hostname = $env:COMPUTERNAME + "." + (Get-WmiObject win32_computersystem).domain
- Add-DnsServerResourceRecordPtr -Name $splitserver[3] -ZoneName $Reverse -AllowUpdateAny -TimeToLive 01:00:00 -AgeRecord -PtrDomainName $hostname
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement