Ping-Status function

I use this function when I’m writing scripts that will
take information from Servers and Clients when
they are on the network.

function Ping-Status {
########################################################################
# Ping-Status function
# Created: 2009-07-21
# By: Fredrik Wall, fredrik[dot]wall[at]riverpoint[dot]se
########################################################################
param ($mysrv)
$pingstatus = Get-WmiObject -Query "SELECT StatusCode FROM win32_PingStatus
WHERE ADDRESS = '$mysrv'"
      if ($pingstatus.StatusCode -eq 0) {
      $true
      }
      else
      {
      $false
      }
}

No related posts.

This entry was posted in PowerShell Blogs and tagged , , , . Bookmark the permalink.

0 Responses to Ping-Status function

  1. Fredrik Wall says:

    RT @walle75 Ping-Status function | Fredrik Wall http://bit.ly/xBmCc

  2. David says:

    Nice function, but it would be even nicer if you could determine packetsize and control the “do not fragment-flag”.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>