Bad boy Warrior Posted December 13, 2006 Share Posted December 13, 2006 I copied ping.exe to a root drive on a domain controller. Along with this i created a text file called PC.txt (which lists all the PCs in our domain) and a batch file with the command ping.exe pc.txt >> answer.txtWhen i run this batch it doesnt return any ping results in answer.txt- how can i ping all pcs in a domain?thx Link to comment Share on other sites More sharing options...
TravisO Posted December 13, 2006 Share Posted December 13, 2006 (edited) You can't do that with DOS, you'll need to rewrite it into vb script:for ($i = 1; $i -le 256; $i++) { $cmd = "ping 192.168.96." + $i; invoke-expression $cmd }If you haven't heard of it, Powershell is MS's equivalent to a Unix shellhttp://www.microsoft.com/windowsserver2003...ll/default.mspxIt requires XP/2003/Vista and .Net 2.0 installed. Edited December 13, 2006 by travisowens Link to comment Share on other sites More sharing options...
Bad boy Warrior Posted December 13, 2006 Author Share Posted December 13, 2006 Thanks for that but how do i add my text file to this code (PC.txt). Im guessing to replace 192.... with my text file name, but that didnt work????I didnt know about Powershell so thanks for the link and ill look into it. Link to comment Share on other sites More sharing options...
jaclaz Posted December 13, 2006 Share Posted December 13, 2006 (edited) You can't do that with DOS, you'll need to rewrite it into vb script:Really? I would have thought that something like:For /F "tokens=* delims=" %%A in (pc.txt) DO Ping %%A >> answer.txtwould work.... @Bad boy WarriorPlease read here a good tutorial about using the above command:http://www.robvanderwoude.com/ntfortokens.htmland extracting needed data...jaclaz Edited December 13, 2006 by jaclaz Link to comment Share on other sites More sharing options...
IcemanND Posted December 13, 2006 Share Posted December 13, 2006 @travisowens - your solution will not ping every machine in a domain. only in a subnet.jaclaz's solution will at least ping every machine in the text file. Which if the query to create it was done correctly can have every machine in the domain listed in it.If you want to eliminate the text file you could use VBS to query the domain for machines and then ping them. Link to comment Share on other sites More sharing options...
jcarle Posted December 13, 2006 Share Posted December 13, 2006 Use NetPing. 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