Solved

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

Posted on 2011-03-02
2
415 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
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

How to sign a powershell script so you can prevent tampering, and only allow users to run authorised Powershell scripts
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

772 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

11 Experts available now in Live!

Get 1:1 Help Now