Getting Data In

Do not run Powershell script when Splunk starts

splunk310805
New Member

Hi,

I want to run a Powershell script on a Windows universal forwarder according to a cron schedule. My input looks similar to this

[powershell://Test]
script = . "$SplunkHome\etc\apps\test\bin\test.ps1"
schedule = */15 * * * *
index = test

Besides running every 15 minutes as it should, I noticed that the script also runs every time when Splunk starts. Reading https://docs.splunk.com/Documentation/Splunk/latest/Admin/Inputsconf it says: "Regardless of which option you choose, the command or script always runs once when the instance starts."

I don't want that. I don't want the script to run when Splunk starts. Is there any way to disable that?

Labels (2)
0 Karma

livehybrid
SplunkTrust
SplunkTrust

Hi @splunk310805 

Its my understanding that this was previously raised as a bug (SPL-141385) which has now been updated in the docs to mention that it will run at startup too. (See https://community.splunk.com/t5/Getting-Data-In/Powershell-script-input-on-a-schedule/m-p/369941#M67...)

Unfortunately the only current workaround for this is to incorporate status checking in the powershell itself, this could be by checking the time since the last execution (e.g. comparison with last modified log file) or by checking that it is expected at a specific time (e.g. if you did 0,15,30,45 in cron schedule you could check its one of these times.

Its not great, but hopefully this helps!

🌟 Did this answer help you? If so, please consider:

  • Adding karma to show it was useful
  • Marking it as the solution if it resolved your issue
  • Commenting if you need any clarification

Your feedback encourages the volunteers in this community to continue contributing

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

.conf25 Global Broadcast: Don’t Miss a Moment

Hello Splunkers, .conf25 is only a click away.  Not able to make it to .conf25 in person? No worries, you can ...

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...