<?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: How to keep powershell process alive in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-keep-powershell-process-alive/m-p/471009#M80962</link>
    <description>&lt;P&gt;Hi @patrickyoko ,&lt;/P&gt;

&lt;P&gt;I'm surprised you needed to do this, to be honest.  I just tested and using &lt;CODE&gt;interval = -1&lt;/CODE&gt; seemed to work for me.  What version of Splunk is this?&lt;/P&gt;

&lt;P&gt;Also, FWIW, for PowerShell scripts you can use the native PowerShell modular input by means of &lt;CODE&gt;powershell://&lt;/CODE&gt; stanzas.&lt;/P&gt;

&lt;P&gt;Hope this helps.&lt;/P&gt;

&lt;P&gt;Cheers,&lt;/P&gt;

&lt;P&gt;- Jo.&lt;/P&gt;</description>
    <pubDate>Tue, 24 Dec 2019 13:18:16 GMT</pubDate>
    <dc:creator>jhornsby_splunk</dc:creator>
    <dc:date>2019-12-24T13:18:16Z</dc:date>
    <item>
      <title>How to keep powershell process alive</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-keep-powershell-process-alive/m-p/471007#M80960</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I've created a Powershell script that I use to monitor a folder.&lt;/P&gt;

&lt;P&gt;It all works how it's suppose to work, but the problem is when I deploy it as an Splunk App, it starts the Script but doesn't keep the powershell process alive.&lt;/P&gt;

&lt;P&gt;Here are the input.conf en .path files I've used.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;inputs.conf
[script://$SPLUNK_HOME\etc\apps\TA_TEST\bin\FolderMonitor.path]
disable=false
interval=-1  
index=winlogs

FolderMonitor.path
$Systemroot\System32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -Command " &amp;amp; '$SPLUNK_HOME\etc\apps\TA_TEST\bin\FolderMonitor.ps1'"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've tried several things&lt;/P&gt;

&lt;P&gt;Changing the .path file to powershell.exe -noexit -noprofile -executionpolicy bypass -Command, but that didn't work at least not when it's deployed by Splunk if I put that directly in Command Prompt it does work.&lt;/P&gt;

&lt;P&gt;Changing the interval from -1 to 0 but that just started a new powershell process, and I need the original process to be kept alive.&lt;BR /&gt;
Any tips or help would be grealy appreciated. &lt;/P&gt;

&lt;P&gt;With kind regards,&lt;BR /&gt;
Patrick&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2019 15:04:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-keep-powershell-process-alive/m-p/471007#M80960</guid>
      <dc:creator>patrickyoko</dc:creator>
      <dc:date>2019-12-19T15:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to keep powershell process alive</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-keep-powershell-process-alive/m-p/471008#M80961</link>
      <description>&lt;P&gt;I've solved the problem by doing the following.&lt;/P&gt;

&lt;P&gt;The first script is creating a dirlist and at the end of the script I'm calling Start-Process powershell.exe "-NoExit . .\FileMonitor.ps1"&lt;/P&gt;

&lt;P&gt;That way the file monitor is being runned as SYSTEM and outside of Splunk.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2019 11:40:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-keep-powershell-process-alive/m-p/471008#M80961</guid>
      <dc:creator>patrickyoko</dc:creator>
      <dc:date>2019-12-20T11:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to keep powershell process alive</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-keep-powershell-process-alive/m-p/471009#M80962</link>
      <description>&lt;P&gt;Hi @patrickyoko ,&lt;/P&gt;

&lt;P&gt;I'm surprised you needed to do this, to be honest.  I just tested and using &lt;CODE&gt;interval = -1&lt;/CODE&gt; seemed to work for me.  What version of Splunk is this?&lt;/P&gt;

&lt;P&gt;Also, FWIW, for PowerShell scripts you can use the native PowerShell modular input by means of &lt;CODE&gt;powershell://&lt;/CODE&gt; stanzas.&lt;/P&gt;

&lt;P&gt;Hope this helps.&lt;/P&gt;

&lt;P&gt;Cheers,&lt;/P&gt;

&lt;P&gt;- Jo.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Dec 2019 13:18:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-keep-powershell-process-alive/m-p/471009#M80962</guid>
      <dc:creator>jhornsby_splunk</dc:creator>
      <dc:date>2019-12-24T13:18:16Z</dc:date>
    </item>
  </channel>
</rss>

