Sign in to follow this  
Followers 0
Yorn

When a ping won't work

9 posts in this topic

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)?

Share this post


Link to post
Share on other sites



Resolving the IP->DNS and vice-vera name can be cached but the actual ping reply should not occure of the computer is offline. You're looking to see 'Reply From" line after the ping command is issued.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

try ipconfig /flushdns..


Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

You could use PING and NbtStat -A IPAddress to confirm.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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)

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

This is precisely what I needed.

Edited by Yorn

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0