Getting Data In

Running a PowerShell script as admin in Splunk

jdhart1312
Loves-to-Learn Everything

I have a PowerShell script that needs to be ran as admin to be able to load in all of the data. It returns a .csv file that exports to the lookups folder so that we can pull out the data and use said data. I have the script in the correct directory in the Splunk server and can see it and I can run it but I'm not getting data out of it which is making me think that the script is not being ran as an admin. I've tried a few things but can't get it to work correctly.

I've come to a couple of different options for what to do here.

1. Make a managed service account that runs the script as an admin.
2. Try to configure splunkd to allow running as admin (if possible?)
3. Other recommendations?

I'm relatively new to Splunk. Just trying to learn all I can and I appreciate any pointers/guidance. 

Labels (1)
Tags (1)
0 Karma

saranvishva
Explorer

Hi have you met all the following conditions,

  • The Splunk platform instance must be configured to use the Local System user to run all PowerShell scripts.
  • PowerShell version 3.0 or higher must be installed on the machine. Microsoft .NET version 4.5 or higher must be installed on the machine.
  • There might be additional requirements to run PowerShell scripts depending on the version of Windows and PowerShell. See the Microsoft documentation on PowerShell for details.
0 Karma

deepakc
Builder

First manually create the lookup and the definitions if using CLI use the below example and test it in splunk, so you know this works. (It sounds like you have done this, not sure)

Ensure this knowledge Object inside your app/lookup folder and  the lookup  is shared for all - (you may have done this all in the GUI,not sure) 

/yourapp/local/transforms.conf
[mylookup]
filename = my_lookup.csv

From your Splunk search bar run the below - to see the data
inputputlookup mylookup


If this works then it must be a permissions issue somewhere post your powershell script process, ensure the splunk user or what user you have used on the Splunk/Windows patform can read the lookup file and its the same name when you created it, like in the transfoms.

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Where Innovation Takes Flight: The Splunk4Aviation Flight Sim Lands at .conf26

If you hear someone at .conf26 shouting "gear down, GEAR DOWN" across the show floor, you have found us.  The ...

Turn Cisco Telemetry Into Action with Cisco Data Fabric, powered by the Splunk ...

The surge in machine data is already hitting enterprise budgets, and the agentic era will only intensify it. ...

Persistent Queue at TcpOut — One of Splunk's Most Practical Features

Splunk introduced persistent queueing at the tcpout layer as one of the most practical resilience features in ...