?
Solved

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

Posted on 2011-03-02
2
Medium Priority
?
427 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 2000 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

 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

Question has a verified solution.

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

Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
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 anti-spam), the admin…
Loops Section Overview
Suggested Courses

807 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