Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

DOS Command  OR Scripts

Posted on 2013-11-19
6
Medium Priority
?
357 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
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
Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

 
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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
A walk-through example of how to obtain and apply new DID phone numbers to your cloud PBX enabled users that are configured in Office 365. Whether you have 1, 10 or 100+ users in your tenant, it's quite easy to get them phone-enabled and making/rece…
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 anti-spam), the admin…
Screencast - Getting to Know the Pipeline

782 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