Getting Data In
Highlighted

## When executing two different PowerShell scripts in inputs.conf, why does only one script work?

New Member

Hi
I'm trying to execute 2 different powershell scripts with different sourcetypes but on the same index. one of them is running but the second does not.

moreover, when i put one of the scripts in disabled=false and the other as true, it runs ok.

did it happen to someone?

Highlighted

## Re: When executing two different PowerShell scripts in inputs.conf, why does only one script work?

SplunkTrust

Can you share your input.conf configuration (for these two scripted input)?

Highlighted

## Re: When executing two different PowerShell scripts in inputs.conf, why does only one script work?

New Member

yeah sure, that's my input.conf:

###### First Script

[powershell://firstscript]
index= second
script

# schedule = 00 5 * * *

sourcetype= second_script
disabled = false

Highlighted

## Re: When executing two different PowerShell scripts in inputs.conf, why does only one script work?

Contributor

This happened to me a few months ago. I fixed it by creating a batch script to call the powershell script.

Highlighted

## Re: When executing two different PowerShell scripts in inputs.conf, why does only one script work?

New Member

but then can i make it with two different sourcetypes?

Highlighted

## Re: When executing two different PowerShell scripts in inputs.conf, why does only one script work?

Contributor

Yeah, using the same method you have above. Just replace the .ps1 with the .bat which calls the .ps1. You can keep the same sourcetypes or change them at your leisure.

Highlighted

## Re: When executing two different PowerShell scripts in inputs.conf, why does only one script work?

New Member

it brings me to splunk the bat text 😞

can you put you example please?

Highlighted

## Re: When executing two different PowerShell scripts in inputs.conf, why does only one script work?

Contributor

Sure, try something like this:

@echo off powershell.exe -ExecutionPolicy bypass -file "X:\Path\to\your\script.ps1"

Highlighted

## Re: When executing two different PowerShell scripts in inputs.conf, why does only one script work?

New Member

sorry for the delay,
I've just tried it but and it does the job this time but again only for one of the scripts

Highlighted

## Re: When executing two different PowerShell scripts in inputs.conf, why does only one script work?

New Member

it parse each row as single event.
do you know what can I do about it?