<?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: Powershell Scripting for SPLUNK in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Powershell-Scripting-for-SPLUNK/m-p/77271#M15816</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/27103"&gt;@sloshburch&lt;/a&gt;, Hello I am assuming that  SPLUNK_HOME already an SYSTEM_ENVIRONMENT variable on the system the script is running on. If it is not you will need to use the SET comment .  &lt;STRONG&gt;SET SPLUNK_HOME=D:/program files/splunk&lt;/STRONG&gt; or the equivalent path.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 15:59:13 GMT</pubDate>
    <dc:creator>bmacias84</dc:creator>
    <dc:date>2020-09-28T15:59:13Z</dc:date>
    <item>
      <title>Powershell Scripting for SPLUNK</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Powershell-Scripting-for-SPLUNK/m-p/77267#M15812</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have installed Splunk in my windows machine and I want to give the scripted input to Splunk.&lt;/P&gt;

&lt;P&gt;I know Splunk does provide ".bat Programming" , Does Splunk support "Powershell Scripting" ? &lt;/P&gt;

&lt;P&gt;If yes then plz share any document where it is clearly defined that how to give "powershell scripting" as an input to the splunk &lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Abhay&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2013 06:01:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Powershell-Scripting-for-SPLUNK/m-p/77267#M15812</guid>
      <dc:creator>abhayneilam</dc:creator>
      <dc:date>2013-03-28T06:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell Scripting for SPLUNK</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Powershell-Scripting-for-SPLUNK/m-p/77268#M15813</link>
      <description>&lt;P&gt;Splunk will run any scripting language your operating system supports whether it be perl, python, ruby, bat, vb, ps1(powershell), etc.  Your OS just need to have an interpreter for it.  So yes it can.&lt;/P&gt;

&lt;P&gt;Do the the following and I am assuming you have are building or have built TA or an app to hold these scripts.&lt;/P&gt;

&lt;P&gt;create a bat script like such called &lt;STRONG&gt;psexecut.cmd&lt;/STRONG&gt;:&lt;BR /&gt;
&lt;CODE&gt;&lt;/CODE&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;BR /&gt;
@ECHO OFF&lt;BR /&gt;
SET MYSPLUNKAPP=myfirstapp&lt;BR /&gt;
Powershell -command ". '%SPLUNK_HOME\etc\apps\%MYSPLUNKAPP\bin\powershell\%1'"&lt;BR /&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;Within a inputs.conf file&lt;BR /&gt;
&lt;CODE&gt;&lt;/CODE&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;BR /&gt;
[script://&amp;lt;path_to_psexecut.cmd&amp;gt;\psexecut.cmd &amp;lt;path_to_powershell_script&amp;gt;]&lt;BR /&gt;
source = &amp;lt;ps_script_name&amp;gt;&lt;BR /&gt;
sourcetype = Powershell&lt;BR /&gt;
interval =10 #in seconds&lt;BR /&gt;
index = wintel #your index&lt;BR /&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;Also read &lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0.2/AdvancedDev/ScriptedInputsIntro"&gt;Scripted inputs&lt;/A&gt; for more information.  Also down load some apps and start dissecting them to see how other are build theirs.&lt;/P&gt;

&lt;P&gt;Hope this helps or gets you started.  If this does help does help dont forget to accept and vote up the answer.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2013 17:11:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Powershell-Scripting-for-SPLUNK/m-p/77268#M15813</guid>
      <dc:creator>bmacias84</dc:creator>
      <dc:date>2013-03-28T17:11:33Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell Scripting for SPLUNK</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Powershell-Scripting-for-SPLUNK/m-p/77269#M15814</link>
      <description>&lt;P&gt;Another option is to use the ".path file" which is (lightly) documented in the inputs.conf spec file (&lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0.2/admin/Inputsconf"&gt;http://docs.splunk.com/Documentation/Splunk/5.0.2/admin/Inputsconf&lt;/A&gt;). See also: &lt;A href="http://splunk-base.splunk.com/answers/309/powershell-scripted-input"&gt;http://splunk-base.splunk.com/answers/309/powershell-scripted-input&lt;/A&gt; for examples.&lt;/P&gt;

&lt;P&gt;From the docs:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;cmd can also be a path to a file that ends with a ".path" suffix. A file with this suffix is a special type of  pointer file that points to a command to be executed.  Although the pointer file is bound by the same location restrictions mentioned above, the command referenced inside it can reside anywhere on the file system.  This file must contain exactly one line: the path to the command to execute, optionally followed by command line arguments.  Additional empty lines and lines that begin with '#' are also permitted and will be ignored.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also, in a week or so, we are releasing a PowerShell modular input that lets you embed a PowerShell script into your inputs.conf file and has some other really cool features. Watch &lt;A href="http://blogs.splunk.com/"&gt;http://blogs.splunk.com/&lt;/A&gt; for that.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Apr 2013 13:55:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Powershell-Scripting-for-SPLUNK/m-p/77269#M15814</guid>
      <dc:creator>halr9000</dc:creator>
      <dc:date>2013-04-01T13:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell Scripting for SPLUNK</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Powershell-Scripting-for-SPLUNK/m-p/77270#M15815</link>
      <description>&lt;P&gt;Were you able to get the %SPLUNK_HOME part of the cmd file to work? When I run it that way I get this:&lt;BR /&gt;
The module 'SPLUNK_HOME' could not be loaded. For more information, run 'Import-Module SPLUNK_HOME'&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:59:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Powershell-Scripting-for-SPLUNK/m-p/77270#M15815</guid>
      <dc:creator>sloshburch</dc:creator>
      <dc:date>2020-09-28T15:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell Scripting for SPLUNK</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Powershell-Scripting-for-SPLUNK/m-p/77271#M15816</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/27103"&gt;@sloshburch&lt;/a&gt;, Hello I am assuming that  SPLUNK_HOME already an SYSTEM_ENVIRONMENT variable on the system the script is running on. If it is not you will need to use the SET comment .  &lt;STRONG&gt;SET SPLUNK_HOME=D:/program files/splunk&lt;/STRONG&gt; or the equivalent path.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:59:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Powershell-Scripting-for-SPLUNK/m-p/77271#M15816</guid>
      <dc:creator>bmacias84</dc:creator>
      <dc:date>2020-09-28T15:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell Scripting for SPLUNK</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Powershell-Scripting-for-SPLUNK/m-p/77272#M15817</link>
      <description>&lt;P&gt;I guess I assumed it was available as part of the splunk run time (like how it is for other scripts).  Is it not the same as the $SPLUNK_HOME environment variable available to splunk already?  Let me know if that made no sense.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2014 22:03:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Powershell-Scripting-for-SPLUNK/m-p/77272#M15817</guid>
      <dc:creator>sloshburch</dc:creator>
      <dc:date>2014-02-26T22:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell Scripting for SPLUNK</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Powershell-Scripting-for-SPLUNK/m-p/77273#M15818</link>
      <description>&lt;P&gt;$SPLUNK_HOME is only known to splunk native processes.  Powershell is a windows specific shell that doesnt not know about Splunk ENV variables.  Try typing SET and see what pops up as define ENV variables.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2014 05:49:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Powershell-Scripting-for-SPLUNK/m-p/77273#M15818</guid>
      <dc:creator>bmacias84</dc:creator>
      <dc:date>2014-02-27T05:49:44Z</dc:date>
    </item>
  </channel>
</rss>

