Yorn Posted August 20, 2007 Share Posted August 20, 2007 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 More sharing options...
evilertoaster Posted August 20, 2007 Share Posted August 20, 2007 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. Link to comment Share on other sites More sharing options...
Yorn Posted August 21, 2007 Author Share Posted August 21, 2007 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 More sharing options...
lordofthestrings Posted August 22, 2007 Share Posted August 22, 2007 try ipconfig /flushdns.. Link to comment Share on other sites More sharing options...
Yorn Posted August 30, 2007 Author Share Posted August 30, 2007 (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 August 30, 2007 by Yorn Link to comment Share on other sites More sharing options...
Joon Posted August 30, 2007 Share Posted August 30, 2007 You could use PING and NbtStat -A IPAddress to confirm. Link to comment Share on other sites More sharing options...
Yorn Posted August 30, 2007 Author Share Posted August 30, 2007 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 More sharing options...
MadBoy Posted August 30, 2007 Share Posted August 30, 2007 (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 August 30, 2007 by MadBoy My little company: Evotec (PL version: Evotec) Link to comment Share on other sites More sharing options...
Yorn Posted October 3, 2007 Author Share Posted October 3, 2007 (edited) This is precisely what I needed. Edited October 3, 2007 by Yorn Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now