Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am investigating a perf issue in the field. Typically, there just isn't enough bandwidth for my app to be speedy. Typically the way it works, is that I ask to Terminal (via VNC or WebEx) into the user's machine, then crank up the command window and run PING to the server to see the latency.

This procedure is pretty time consuming (e.g. sometimes people are not even at their desk, etc...).

Is there a way for me to run PING remotely from the user's machine to the server without ever involving the user?

Or is there a better alternative?

share|improve this question

4 Answers 4

There is a program I have used called Desktop Central Free. It allows you to connect into a remote computer's command prompt and run whatever you want. As long as the machine is up, this tool can help out a lot. It also has many other options/tools that you can do from remote computers without involving other user input.

share|improve this answer

If the user's machine has a public IP address (it's not behind NAT) you can ping their machine from the server.

share|improve this answer

I rather like PowerShell's Test-Connection

Test-Connection computerperformance.co.uk 

Source        Destination     IPV4Address      Bytes    Time(ms) 
------        -----------     -----------      -----    -------- 
WIN7          computerperf... 72.26.108.9      32       148      
WIN7          computerperf... 72.26.108.9      32       149      
WIN7          computerperf... 72.26.108.9      32       149      
WIN7          computerperf... 72.26.108.9      32       149    

Naturally you can use a ComputerName instead of a website. I suggest this solution because it gives the time, hence the ability to measure latency.

share|improve this answer

Not sure if the OP was answered, so I'll submit what I've developed after unsuccessfully searching for the same answer.

I use two different approaches to this, to test connections between Exchange servers and the server that will be designated in a the New-MailboxExportRequest -FilePath argument.

#invoke-command (test-connection)
function Get-TestConnectionResponseTime
{
#returns a hash of min, max, avg ping times
param($Pingee,$Pinger)
$TCScript="
    `$result = Test-Connection $Pingee
    `$min=(`$result|Measure-Object -Minimum -Property responsetime).Minimum
    `$max=(`$result|Measure-Object -Maximum -Property responsetime).Maximum
    `$avg=(`$result|Measure-Object -Average -Property responsetime).Average
    @{Min=`$min;Max=`$max;Avg=`$avg}
    "

$CxtScript = $ExecutionContext.InvokeCommand.NewScriptBlock($TCScript)
try{
    Invoke-Command -ComputerName $Pinger -ScriptBlock $CxtScript -ErrorAction Stop}
catch [System.Management.Automation.RuntimeException]{
    return "Probably a firewall restriction: " + $error[0].FullyQualifiedErrorId}
catch{
    return "From catch-all error trap: " + $error[0].FullyQualifiedErrorId}
}

#start-process (psexec -> ping)
function Get-PingResponseTime
{
#uses start-process to run ping from remote to remote, returns a hash of min, max, avg ping times

# this one is slow and clunky, but psexec is allowed though some of the firewalls I contend with, 
# and invoke-command isn't. To collect the output in the script, I had to write it to a log and 
# pick it up afterwards (by watching for the last line of the output to appear in the log file)

param($Pingee,$Pinger)
$argumentlist = "$Pinger ping $Pingee"
$timestamp = Get-Date
$psexecID = Start-Process -FilePath psexec -ArgumentList ("\\" + $argumentlist) -NoNewWindow -RedirectStandardOutput \\MyComputer\c$\temp\pinglog.txt -PassThru #-Wait
Write-Host "Started process" $psexecID.Name
#wait for the remote process to finish
While(Get-Process -ComputerName $Pinger | ?{$_.Name -eq $psexecID.Name}){
    Write-Host "." -NoNewline 
    }
#wait for the completed log file on my local system
Write-Host "Waiting for $pinger to return results..."
while(!((Get-Content C:\temp\pinglog.txt) -match "Average = ")){
    Write-Host "." -NoNewline
    Start-Sleep -Seconds 1
    }
Write-Host " ah, there they are!"
#parse the ping output
$pingtimes = ((Get-Content C:\temp\pinglog.txt) -match "Average = ").trim() -split ", " | %{($_ -split " = ")[1].trim("ms")}
return @{Min=$pingtimes[0];Max=$pingtimes[1];Avg=$pingtimes[2]}
}

Hopes this helps someone.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.