INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

How to verify DNS to DHCP

How to verify DNS to DHCP

(OP)
Not for sure if I am over looking something but I have not been able to find a good way to verify that DNS entries are correct for my computers.
If anyone has an idea or has already done this and would like to share that would be awesome.

I have all my computers in a text file from AD that I would like to verify that the DNS forward and reverse Lookup zones are correct based off of the DHCP lease.
We constant are unable to communicate with computers because DNS is pointing to the wrong address and was hoping for an easier and more proactive way to catch these before they are a problem.

RE: How to verify DNS to DHCP

Can you give an example, just for clarification?

I believe you can query DNS with
[System.Net.Dns]::GetHostAddresses("<Hostname@Domain>")
[System.Net.Dns]::GetHostEntry("<IPAdress>")


Light travels faster than sound. That's why some people appear bright until you hear them speak.

RE: How to verify DNS to DHCP

(OP)
This is what I got but it is not working so not for sure. Still learning this stuff.


$leases = Get-DhcpServerv4Lease -ScopeId 192.168.0.0 -ComputerName "myServer" foreach ($lease in $leases) {
$hostname = $lease.HostName
$ipAddress = $lease.IPAddress
$dnsHostNameEntry = [System.Net.Dns]::Resolve($ipaddress)
$dnsHostAddressEntry = [System.Net.Dns]::Resolve($ipaddress)

}

RE: How to verify DNS to DHCP

(OP)
Maybe I am missing something that I don't realize. I am running powershell from a windows 7 machine using powershell v5.
I am getting this error code below. Do I need to install something else?

The term 'Get-DhcpServerv4Lease' is not recognized as the name of a cmdlet

RE: How to verify DNS to DHCP

What does your input file look like and does it have headers on the columns or not?


Light travels faster than sound. That's why some people appear bright until you hear them speak.

RE: How to verify DNS to DHCP

(OP)
Well I don't have a input file as I was assuming this script was creating the file once I put in the export to csv command.
I thought that by coding the servername and scope that I would not need an input file. Again still learning all this powershell language just by reading on google so if I am doing something wrong let me know.

RE: How to verify DNS to DHCP

(With regards to your error) My guess is that you don't have the DhcpServer module loaded.

Run: Get-Module

If, under the name column, you don't see an entry for DhcpServer, then that's your problem.

If you have the tools installed on the server/workstation you're running the commands on, you should be able to load it by running:
Import-Module DhcpServer


Light travels faster than sound. That's why some people appear bright until you hear them speak.

RE: How to verify DNS to DHCP

(OP)
Ok looks like the only ones I have are as followed
ISE
Microsoft.Powershell.Managment
Microsoft.Powershell.Utility

RE: How to verify DNS to DHCP

Quote (cojast08)

I have all my computers in a text file from AD that I would like to verify that the DNS forward and reverse Lookup zones are correct based off of the DHCP lease.

I may not understand exactly what you're doing, but I think you need something as the master list to check if it's even in DNS. That list can be from a text file or possibly pulled from AD.


Light travels faster than sound. That's why some people appear bright until you hear them speak.

RE: How to verify DNS to DHCP

(OP)
OK where do I get the tools to run the DHCPServer modules... right now that is the first error that I am getting that the module or cmdlet is not valid.
Once I can get that fixed I can move on to the next issue. I might not need the computer txt answer file if I can get the DHCP to check the scopes.

RE: How to verify DNS to DHCP

They are the Microsoft tools: RSAT
You'll have to find the ones for the OS of the system from which you are running PowerShell.


Light travels faster than sound. That's why some people appear bright until you hear them speak.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close