Solved

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

Posted on 2011-03-02
2
420 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
[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 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article will help you understand what HashTables are and how to use them in PowerShell.
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
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…
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…

739 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