Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

DOS Command  OR Scripts

Posted on 2013-11-19
6
Medium Priority
?
355 Views
Last Modified: 2013-12-04
Hi EE,

I am looking for the scripts or command to ping the list servers that located in domain from text or excel file and get the result in notepad, Could any one help on this? Please and Thank you

Regards,
J Peter
0
Comment
Question by:Jey_P
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 300 total points
ID: 39659804
From a command line:
for /f %a in (c:\servers.txt) do ping %a -n 1 >> results.txt

or in a batch file:

@echo off
for /f %%a in (c:\servers.txt) do ping %%a -n 1 >> results.txt

Open in new window

0
 
LVL 85

Assisted Solution

by:oBdA
oBdA earned 150 total points
ID: 39659814
Batch file that creates a csv:
@echo off
setlocal
set ServerFile=Servers.txt
set LogFile=%~dpn0.csv
set CsvDelim=,
if exist "%LogFile%" del "%LogFile%"
for /f %%a in ('type "%ServerFile%"') do (
	echo Processing %%a ...
	ping -4 -n 4 %%a | find /i "TTL" >NUL
	if errorlevel 1 (
		>>"%LogFile%" echo %%a%CsvDelim%Error 
		echo ... offline.
	) else (
		echo ... responding.
		>>"%LogFile%" echo %%a%CsvDelim%Success
	)
)
echo Done.
start "" notepad.exe "%LogFile%"

Open in new window

0
 
LVL 13

Expert Comment

by:duncanb7
ID: 39659828
Hope it will help
@echo off
:Start

REM cd "c:\your location if you need"
for /f "tokens=* delims=" %%x in (d:\ping.txt) do ping %%x
echo.
echo.

Open in new window

0
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

 
LVL 40

Assisted Solution

by:Subsun
Subsun earned 150 total points
ID: 39659837
Wit PowerShell...
Try..
GC C:\Server.txt | % {
$Server = $_
 If (Test-Connection $Server -Quiet){
	 New-Object PSOBJect -Property @{
	 Server = $Server
	 Status = "UP"
 	}
 }
 Else{
	 New-Object PSOBJect -Property @{
	 Server = $Server
	 Status = "Down"
         }
 }
} | Export-Csv C:\report.csv -nti

Open in new window

Input file..
ServerA
ServerB
ServerC

Open in new window

0
 
LVL 13

Assisted Solution

by:duncanb7
duncanb7 earned 75 total points
ID: 39659863
it works with less code
@echo off
:Start
del -f out.txt
REM cd "c:\your location if you need"
REM ping.txt store all your server name
for /f "tokens=* delims=" %%x in (c:\ping.txt) do ping %%x>>out.txt
start  notepad.exe "out.txt"

Open in new window

0
 
LVL 15

Assisted Solution

by:David L. Hansen
David L. Hansen earned 75 total points
ID: 39659867
You can use MS Powershell to do this (and it's free).  Here are a couple of links to show you where people are already doing exactly the same thing you are trying.

http://powergui.org/thread.jspa?threadID=20236

http://www.experts-exchange.com/Programming/Languages/Scripting/Powershell/Q_26672523.html

It is included in the Windows Management Framework download here.
0

Featured Post

Protect Your Retail Business and Reputation

Wi-Fi access doesn't just impact your business & customer experience, it can also affect your security.  Join us for an informative webinar to learn more about the top threats and trends impacting retail today, and the key solutions to protecting retail networks and reputations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question