Solved

How to capture a response from a ping on a Linux box in a Powershell script

Posted on 2011-03-02
2
416 Views
Last Modified: 2012-05-11
Experts,

          I want to ping a Linux box from a Win2K3 server. Based on the information returned, If the reply includes TTL=254 then the box is Linux. Then I can connect to the Linux box and execute the local script.
How do I capture this in code in a Powershell script? I will be using Putty or Plink to issue the command.

Thanks, Missymadi
0
Comment
Question by:missymadi
2 Comments
 
LVL 13

Expert Comment

by:Superdave
ID: 35020901
You could use the free open-source nmap (http://nmap.org/) to do the ping fingerprinting (I don't think you can do it with the standard Windows ping command).  It runs on Windows and Unix and can be run both as a GUI and from the command line.
0
 
LVL 10

Accepted Solution

by:
wls3 earned 500 total points
ID: 35024587
I might be oversimplifying this:

foreach($IP in $IPList)
{
  $pingresults = ping $IP
  if($pingresults -match "TTL=256") 
  {
    Start-Process -FilePath C:\Wherever\Putty\Is\Putty.exe -Argumentlist "Don't be too argumentative"
  }
}

Open in new window

0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

"Migrate" an SMTP relay receive connector to a new server using info from an old server.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
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…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

895 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now