Solved

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

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

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

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

Utilizing an array to gracefully append to a list of EmailAddresses
A procedure for exporting installed hotfix details of remote computers using powershell
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…

685 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