Solved

Need something(script?) to run Ping -t in background?

Posted on 2008-10-23
2
1,883 Views
Last Modified: 2013-11-29
I need something, a script or batch file maybe, that will run ping -t command in the background so the user doesnt see it.

The exact Ping command it needs to run is:

Ping Datatrack -t

Again I need someway for this to run in the background or system tray so the user doesnt see the command prompt.

If someone can give me the exact code to do this, that way I can just copy and paste into notepad and rename the extension, that would be great.

Thanks in advance for all the help!
0
Comment
Question by:jrouille
[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
2 Comments
 
LVL 65

Accepted Solution

by:
RobSampson earned 250 total points
ID: 22792315
Hi, this should do it, but you'd have to kill wscript.exe when you want it to stop....

Regards,

Rob.
Option Explicit
 
Dim strComputer, boolResult, objShell, arrComputers
 
strComputer = "DataTrack"
Set objShell = CreateObject("WScript.Shell")
boolResult = Ping(strComputer)
If boolResult = False Then
	MsgBox "Ping to " & strComputer & " failed!",vbOKOnly,"Failed"
ElseIf boolResult = True Then
	MsgBox "Ping to " & strComputer & " successful!",vbOKOnly,"Successful"
Else
	MsgBox "Unknown error occurred.  No result returned.",vbOKOnly,"Failed"
End If
 
Function Ping(strComputer)
	Dim objShell, boolCode
	Set objShell = CreateObject("WScript.Shell")
	boolCode = objShell.Run("Ping -t " & strComputer, 0, True)
	If boolCode = 0 Then
		Ping = True
	Else
		Ping = False
	End If
End Function

Open in new window

0
 
LVL 14

Assisted Solution

by:rejoinder
rejoinder earned 250 total points
ID: 22873988
Copy the text below into notepad and save as ping-computer.vbs
The script will continue to ping the computer as long as the process is running.
You can run this through task scheduler or you can put the vbs file in the users startup folder.  If you run this using task scheduler, you have a little more control over starting and stopping the script.

strComputer  = "Datatrack" 'Enter the computer name you want to ping here
strHost      = "."
loopVariable = 0
 
Do While loopVariable < 1
    Set PingResults = GetObject("winmgmts:{impersonationLevel=impersonate}//" & strHost & "/root/cimv2"). ExecQuery("SELECT * FROM Win32_PingStatus WHERE Address = '" + strComputer + "'")
    wscript.sleep 1000
Loop

Open in new window

0

Featured Post

Business Impact of IT Communications

What are the business impacts of how well businesses communicate during an IT incident? Targeting, speed, and transparency all matter. Find out more in this infographic.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Renaming with batch file 9 108
cscript to activate Windows and Office? 2 148
Network over eigrp 100 topology ? 3 90
Help with Classic ASP - Parameterizing Query 16 63
How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
We recently endured a series of broadcast storms that caused our ISP to shut us down for brief periods of time. After going through a multitude of tests, we determined that the issue was related to Intel NIC drivers on some new HP desktop computers …
Viewers will learn how to properly install and use Secure Shell (SSH) to work on projects or homework remotely. Download Secure Shell: Follow basic installation instructions: Open Secure Shell and use "Quick Connect" to enter credentials includi…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

737 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