<?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 Run a script after Splunk service stops in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Run-a-script-after-Splunk-service-stops/m-p/571184#M101186</link>
    <description>&lt;P&gt;If I were to have the UF run a PowerShell script, and that script stops the UF, does that also end that PowerShell script session? If so, is there a way to keep it running?&lt;/P&gt;</description>
    <pubDate>Fri, 15 Oct 2021 20:59:24 GMT</pubDate>
    <dc:creator>cboillot</dc:creator>
    <dc:date>2021-10-15T20:59:24Z</dc:date>
    <item>
      <title>Run a script after Splunk service stops</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Run-a-script-after-Splunk-service-stops/m-p/571184#M101186</link>
      <description>&lt;P&gt;If I were to have the UF run a PowerShell script, and that script stops the UF, does that also end that PowerShell script session? If so, is there a way to keep it running?&lt;/P&gt;</description>
      <pubDate>Fri, 15 Oct 2021 20:59:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Run-a-script-after-Splunk-service-stops/m-p/571184#M101186</guid>
      <dc:creator>cboillot</dc:creator>
      <dc:date>2021-10-15T20:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: Run a script after Splunk service stops</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Run-a-script-after-Splunk-service-stops/m-p/571202#M101187</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/41812"&gt;@cboillot&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;sorry but using Splunk you cannot run actions on Universal Forwarders, you have to find a different way.&lt;/P&gt;&lt;P&gt;As a workaround, you could create an alert on the Splunk server that runs a remote Powershell script, if acceptable for you.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Sat, 16 Oct 2021 10:03:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Run-a-script-after-Splunk-service-stops/m-p/571202#M101187</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-10-16T10:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: Run a script after Splunk service stops</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Run-a-script-after-Splunk-service-stops/m-p/571215#M101189</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/41812"&gt;@cboillot&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I think you are trying to run a script to change setting UF and restart. Stopping the UF process will also stop the Powershell script since it is a child.&lt;/P&gt;&lt;P&gt;You can continue your Powershell actions using another Powershell script by starting a second script for stopping or restarting UF. You should start the second one using the "Start-Process" command. This command will create a separate process that will not be the child of UF.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Oct 2021 17:42:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Run-a-script-after-Splunk-service-stops/m-p/571215#M101189</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2021-10-16T17:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: Run a script after Splunk service stops</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Run-a-script-after-Splunk-service-stops/m-p/571388#M101202</link>
      <description>&lt;P&gt;This is what I had thought, but its not working. It gets to the point were it stops Splunk, but then nothing. The file I have in referenced in the inputs is named 'kickoff.ps1'.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;start-process powershell.exe "-noexit -noprofile -executionpolicy bypass . C:\SplunkUniversalForwarder\etc\apps\upgradeTest\bin\splunkforwarder-install.ps1"&lt;/PRE&gt;&lt;P&gt;This is working as it the referenced script stops Splunk. But after that, it just stops. The script itself works as I can run it from the desktop successfully.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Oct 2021 18:17:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Run-a-script-after-Splunk-service-stops/m-p/571388#M101202</guid>
      <dc:creator>cboillot</dc:creator>
      <dc:date>2021-10-18T18:17:22Z</dc:date>
    </item>
  </channel>
</rss>

