Jump to content

When a ping won't work


Yorn
 Share

Recommended Posts

I figured out how to use the ping command to determine if a computer is online before my script attempts to connect and copy a file, but sometimes pinging a computer works because DNS/Active Directory still maintains the entry. When I try to use computer management on these computernames, I get an error (which is how I determine if they are really online or not as a person). For an AutoIt script, however, I don't know of a way to determine if a computer is online or not.

The error message one get's if they try to do a "dir \\COMPUTER\c$" is as follows:

H:\>dir \\COMPUTERNAME\c$

You were not connected because a duplicate name exists on the network. Go to System in Control Panel to change the computer name and try again.

Any suggestions or ways to determine this in advance (will help me discover and prevent long wait times for the rest of the script)?

Link to comment
Share on other sites

Yeah, well, here's the thing, Ping works.

That's not the problem. The problem is that ping works when the computer itself is offline and another computer has been assigned the IP the old one had. If I do a reverse DNS it's a different computer.

Link to comment
Share on other sites

  • 2 weeks later...

ipconfig /flushdns doesn't work either because the bad record is still in Active Directory/DNS so the DNS server is actually still resolving that IP. Or, at least, it's trying to.

Edited by Yorn
Link to comment
Share on other sites

Yeah, that's what I've been considering so far, unfortunately I don't know how to get the name from both and conclude for "X" ip address, the "nslookup <IP>" is A and the "nbtstat -A <IP>" is B. If I could somehow put triggers on the results of an nbtstat, then that'd solve my problem.

Link to comment
Share on other sites

Yeah, that's what I've been considering so far, unfortunately I don't know how to get the name from both and conclude for "X" ip address, the "nslookup <IP>" is A and the "nbtstat -A <IP>" is B. If I could somehow put triggers on the results of an nbtstat, then that'd solve my problem.

@Yorn:

I wrote program that compares Rev-DNS and DNS responses and see if those match. We have that problem in our company that vpn clients get new ip every time they connect. Basically the program gets computer list from .txt file and checks all of them and puts results back into .csv file. I think based on result of that you could do whatever you want to do if the revDns and DNS matches and the ping is responding. If you need the code msg me and i'll send it to you.

CSV file has this fields included as a result: Nr,Short Name, Full Computer Name,Resolved Name,Resolved IP,Test Result,Time to Execute"

Actually you can get the script here: http://www.autoitscript.com/forum/index.php?showtopic=52377

Edited by MadBoy

My little company: Evotec (PL version: Evotec)

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...