<?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: Why is Powershell input not receiving data? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Why-is-Powershell-input-not-receiving-data/m-p/597258#M104265</link>
    <description>&lt;P&gt;No, transcription isn't enabled.&amp;nbsp; &amp;nbsp; Splunk version is 8.1.6.&lt;/P&gt;</description>
    <pubDate>Tue, 10 May 2022 21:21:47 GMT</pubDate>
    <dc:creator>mikelanghorst</dc:creator>
    <dc:date>2022-05-10T21:21:47Z</dc:date>
    <item>
      <title>Why is Powershell input not receiving data?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-is-Powershell-input-not-receiving-data/m-p/597217#M104252</link>
      <description>&lt;P&gt;I had a windows admin create a powershell script for me (requires code-signing, plus app whitelisting complexity), and have configured as a Splunk input.&amp;nbsp; It's working fine from a powershell prompt, and I can see from _internal that Splunk is executing it, but I'm receiving no output.&lt;/P&gt;
&lt;P&gt;Script:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;#main
$command =
{
  try
  {
    $Response = Invoke-WebRequest -Uri 'www.google.com'
    $StatusCode = $Response.StatusCode
  }
  catch
  {
    $StatusCode = $_.Exception.Response.StatusCode.value__
    if ($StatusCode -eq $null){
      $StatusCode = '000'
    }
  }
  return $StatusCode
}
$StatusCode = invoke-command  -ScriptBlock $command
Switch ($StatusCode) {
  '000' { write-warning ('Web_Connectivity url=www.google.com status=failure status_code={0}' -f $statuscode) -Verbose }
  default { write-host ('Web_Connectivity url=www.google.com status=success status_code={0}' -f $statuscode) -ForegroundColor Green }
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With this inputs.conf:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[powershell://test-internetaccessSplunk]
script = . "$SplunkHome\etc\apps\test_Windows_Scripts\bin\test-internetaccessSplunk.ps1"
schedule = */5 * 9-16 * 1-5
sourcetype = Script:Web_Connectivity
source = Script:Web_Connectivity
index = win_test&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;*note:&amp;nbsp; schedule to be updated to once/day once it works.&lt;/P&gt;
&lt;P&gt;_internal log events:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;05-10-2022 09:45:00.0001576-7 INFO Start executing script=. "$SplunkHome\etc\apps\test_Windows_Scripts\bin\test-internetaccessSplunk.ps1" for stanza=test-internetaccessSplunk
05-10-2022 09:45:00.8595184-7 INFO End of executing script=. "$SplunkHome\etc\apps\test_Windows_Scripts\bin\test-internetaccessSplunk.ps1" for stanza=test-internetaccessSplunk, execution_time=0.8593608 seconds&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2022 17:04:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-is-Powershell-input-not-receiving-data/m-p/597217#M104252</guid>
      <dc:creator>mikelanghorst</dc:creator>
      <dc:date>2022-05-10T17:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: Why is Powershell input not receiving data?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-is-Powershell-input-not-receiving-data/m-p/597250#M104260</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/1489"&gt;@mikelanghorst&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Do you have PowerShell Transcription enabled, perchance?&amp;nbsp; And also, what is the version of the Splunk that is running the PowerShell modular input?&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;- Jo.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2022 19:37:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-is-Powershell-input-not-receiving-data/m-p/597250#M104260</guid>
      <dc:creator>jho-splunk</dc:creator>
      <dc:date>2022-05-10T19:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: Why is Powershell input not receiving data?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-is-Powershell-input-not-receiving-data/m-p/597258#M104265</link>
      <description>&lt;P&gt;No, transcription isn't enabled.&amp;nbsp; &amp;nbsp; Splunk version is 8.1.6.&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2022 21:21:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-is-Powershell-input-not-receiving-data/m-p/597258#M104265</guid>
      <dc:creator>mikelanghorst</dc:creator>
      <dc:date>2022-05-10T21:21:47Z</dc:date>
    </item>
  </channel>
</rss>

