<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Poking TCP Ports from Windows PowerShell in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Poking-TCP-Ports-from-Windows-PowerShell/m-p/199196#M39451</link>
    <description>&lt;P&gt;I found that and tried it to no avail. I was hoping that someone on the forum had tried to do something similar and found a way to do it from Splunk or had created app with a built-in modular input. Judging by the lack of responses I feel like that is not really the case...&lt;/P&gt;</description>
    <pubDate>Tue, 17 Jun 2014 18:50:22 GMT</pubDate>
    <dc:creator>ShaneNewman</dc:creator>
    <dc:date>2014-06-17T18:50:22Z</dc:date>
    <item>
      <title>Poking TCP Ports from Windows PowerShell</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Poking-TCP-Ports-from-Windows-PowerShell/m-p/199194#M39449</link>
      <description>&lt;P&gt;A vendor is requesting that we Poke several TCP ports and send specific text to capture application status. "Poke 8080, send http GET for / and Poke TCP 5222 and send string 'test123'".&lt;/P&gt;

&lt;P&gt;I know how to use powershell to initiate a telnet connection to the ports and monitor port status that way:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$Port = 8080,5222,5223
foreach ($P in $Port) {
$Socket = New-Object Net.Sockets.TcpClient
$Computer = "LocalHost"
$RunTime = get-date

# Suppress error messages
$ErrorActionPreference = 'SilentlyContinue'

# Try to connect
$Socket.Connect($Computer, $P)

# Determine if we are connected.
if ($Socket.Connected) {
 "$RunTime Port $P is open"
  $Socket.Close()   
  }
  else {
  "$RunTime Port $P is closed" 
  }
  }
  $Socket = $null
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I modify this code to also pass a text string or command?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jun 2014 02:25:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Poking-TCP-Ports-from-Windows-PowerShell/m-p/199194#M39449</guid>
      <dc:creator>ShaneNewman</dc:creator>
      <dc:date>2014-06-17T02:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: Poking TCP Ports from Windows PowerShell</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Poking-TCP-Ports-from-Windows-PowerShell/m-p/199195#M39450</link>
      <description>&lt;P&gt;Not really a Splunk question.  Wouldn't you reach a more informed audience on a more Windows-specific support forum?&lt;/P&gt;

&lt;P&gt;That said, I just did a Google search for "powershell sockets", and amongst the first hits was this: &lt;A href="http://www.leeholmes.com/blog/2009/10/28/scripting-network-tcp-connections-in-powershell/"&gt;Scripting Network / TCP Connections in PowerShell&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jun 2014 11:06:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Poking-TCP-Ports-from-Windows-PowerShell/m-p/199195#M39450</guid>
      <dc:creator>grijhwani</dc:creator>
      <dc:date>2014-06-17T11:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: Poking TCP Ports from Windows PowerShell</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Poking-TCP-Ports-from-Windows-PowerShell/m-p/199196#M39451</link>
      <description>&lt;P&gt;I found that and tried it to no avail. I was hoping that someone on the forum had tried to do something similar and found a way to do it from Splunk or had created app with a built-in modular input. Judging by the lack of responses I feel like that is not really the case...&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jun 2014 18:50:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Poking-TCP-Ports-from-Windows-PowerShell/m-p/199196#M39451</guid>
      <dc:creator>ShaneNewman</dc:creator>
      <dc:date>2014-06-17T18:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: Poking TCP Ports from Windows PowerShell</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Poking-TCP-Ports-from-Windows-PowerShell/m-p/199197#M39452</link>
      <description>&lt;P&gt;I'd post this to serverfault, TechNet forums, /r/powershell, or the like. That said...&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jun 2014 23:16:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Poking-TCP-Ports-from-Windows-PowerShell/m-p/199197#M39452</guid>
      <dc:creator>halr9000</dc:creator>
      <dc:date>2014-06-17T23:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: Poking TCP Ports from Windows PowerShell</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Poking-TCP-Ports-from-Windows-PowerShell/m-p/199198#M39453</link>
      <description>&lt;P&gt;I would suggesting thinking one layer higher. Test the service, not the TCP protocol. 5222 is WS-Man, aka PowerShell remoting. There's a cmdlet for that, and yes, you can invoke it from Splunk. Check out:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://technet.microsoft.com/en-us/library/hh849873.aspx"&gt;http://technet.microsoft.com/en-us/library/hh849873.aspx&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://apps.splunk.com/app/1477/"&gt;http://apps.splunk.com/app/1477/&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="http://technet.microsoft.com/en-us/library/hh849901.aspx"&gt;http://technet.microsoft.com/en-us/library/hh849901.aspx&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;HTH&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jun 2014 23:32:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Poking-TCP-Ports-from-Windows-PowerShell/m-p/199198#M39453</guid>
      <dc:creator>halr9000</dc:creator>
      <dc:date>2014-06-17T23:32:19Z</dc:date>
    </item>
  </channel>
</rss>

