<?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: How to run basic PowerShell script on universal forwarder in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492627#M84198</link>
    <description>&lt;P&gt;Yes, each type of data should has its own &lt;CODE&gt;sourcetype&lt;/CODE&gt;.&lt;BR /&gt;
Be aware that Powershell is not packaged with UF, it must be installed to Windows.&lt;BR /&gt;
Your &lt;CODE&gt;script&lt;/CODE&gt; line look fishy...&lt;/P&gt;</description>
    <pubDate>Thu, 21 Nov 2019 21:56:51 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2019-11-21T21:56:51Z</dc:date>
    <item>
      <title>How to run basic PowerShell script on universal forwarder</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492626#M84197</link>
      <description>&lt;P&gt;I'm trying to do something very simple but for some reason I can not get it to work. I'm trying to run the basic PowerShell command below on a universal forwarder (on a Windows 10 workstation) but the output is not going to Splunk. &lt;/P&gt;

&lt;P&gt;One question I have is what sourcetype should I be using? Each PowerShell command will have a different output...so do I need to have a sourcetype for each command I run? &lt;BR /&gt;
(And I have read the article but its just not clicking for me &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.0/Data/MonitorWindowsdatawithPowerShellscripts"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.0/Data/MonitorWindowsdatawithPowerShellscripts&lt;/A&gt;)&lt;/P&gt;

&lt;P&gt;Key points:&lt;BR /&gt;
*Workstation is connected to the deployment server&lt;BR /&gt;
*I am using a very basic custom add-on app that host the PowerShell command&lt;BR /&gt;
*Custom Add-on app info&lt;BR /&gt;
2 directories -&amp;gt; local and metadata. The local folder has two files: app.conf and inputs.conf (which is below).&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[powershell://test-script]
script = Get-Process | Select-Object Handles, NPM, PM, WS, VM, Id, ProcessName -Last 5
schedule = **system is not showing this correctly but it polls every minute**
sourcetype = Windows:Process
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Nov 2019 21:19:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492626#M84197</guid>
      <dc:creator>manderson_rr</dc:creator>
      <dc:date>2019-11-21T21:19:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to run basic PowerShell script on universal forwarder</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492627#M84198</link>
      <description>&lt;P&gt;Yes, each type of data should has its own &lt;CODE&gt;sourcetype&lt;/CODE&gt;.&lt;BR /&gt;
Be aware that Powershell is not packaged with UF, it must be installed to Windows.&lt;BR /&gt;
Your &lt;CODE&gt;script&lt;/CODE&gt; line look fishy...&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2019 21:56:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492627#M84198</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-11-21T21:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to run basic PowerShell script on universal forwarder</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492628#M84199</link>
      <description>&lt;P&gt;What's wrong with the script? It's almost exactly the example they used in their documentation&lt;/P&gt;

&lt;P&gt;[powershell://Processes-EX1]&lt;BR /&gt;
 script = Get-Process | Select-Object Handles, NPM, PM, WS, VM, Id, ProcessName, @{n="SplunkHost";e={$Env:SPLUNK_SERVER_NAME}}&lt;BR /&gt;
 schedule = 0 */5 * * *&lt;BR /&gt;
 sourcetype = Windows:Process&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:07:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492628#M84199</guid>
      <dc:creator>manderson_rr</dc:creator>
      <dc:date>2020-09-30T03:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to run basic PowerShell script on universal forwarder</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492629#M84200</link>
      <description>&lt;P&gt;Link to dox?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2019 22:28:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492629#M84200</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-11-21T22:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to run basic PowerShell script on universal forwarder</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492630#M84201</link>
      <description>&lt;P&gt;Hi @manderson_rr,&lt;/P&gt;

&lt;P&gt;What is &lt;CODE&gt;schedule&lt;/CODE&gt; set to exactly?&lt;/P&gt;

&lt;P&gt;Also, what version is the UF?&lt;/P&gt;

&lt;P&gt;Cheers,&lt;/P&gt;

&lt;P&gt;- Jo.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2019 22:40:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492630#M84201</guid>
      <dc:creator>jhornsby_splunk</dc:creator>
      <dc:date>2019-11-21T22:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to run basic PowerShell script on universal forwarder</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492631#M84202</link>
      <description>&lt;P&gt;Hi manderson_rr,&lt;BR /&gt;
Your schedule in inputs.conf should be in a cron format. Like if you want the script to run for every 5 minutes your schedule should be equal to the examples in the link below:&lt;BR /&gt;
&lt;A href="https://www.thegeekstuff.com/2011/07/cron-every-5-minutes/"&gt;https://www.thegeekstuff.com/2011/07/cron-every-5-minutes/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Also you can add index in your inputs.conf if you want a separate index for the processes you are monitoring.&lt;BR /&gt;
And if you are adding a custom index don't forget to create this custom index on search head as well.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 05:09:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492631#M84202</guid>
      <dc:creator>nikita_p</dc:creator>
      <dc:date>2019-11-22T05:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to run basic PowerShell script on universal forwarder</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492632#M84203</link>
      <description>&lt;P&gt;My schedule looks like this:  &lt;CODE&gt;* */1 * * *&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;@woodcock Link: &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.0/Data/MonitorWindowsdatawithPowerShellscripts"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.0/Data/MonitorWindowsdatawithPowerShellscripts&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Under PowerShell input configuration values &amp;gt;&amp;gt; Single command example&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 16:52:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492632#M84203</guid>
      <dc:creator>manderson_rr</dc:creator>
      <dc:date>2019-11-22T16:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to run basic PowerShell script on universal forwarder</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492633#M84204</link>
      <description>&lt;P&gt;Link: &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.0/Data/MonitorWindowsdatawithPowerShellscripts"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.0/Data/MonitorWindowsdatawithPowerShellscripts&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Under PowerShell input configuration values &amp;gt;&amp;gt; Single command example&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 17:00:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492633#M84204</guid>
      <dc:creator>manderson_rr</dc:creator>
      <dc:date>2019-11-22T17:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to run basic PowerShell script on universal forwarder</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492634#M84205</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;[powershell://manderson-script]
script = Get-Process | Select-Object Handles, NPM, PM, WS, VM, Id, ProcessName -Last 5
schedule = 0 */1 * * *
sourcetype = Windows:Process
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;UF --&amp;gt; 7.3.1.1&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 17:02:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492634#M84205</guid>
      <dc:creator>manderson_rr</dc:creator>
      <dc:date>2019-11-22T17:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to run basic PowerShell script on universal forwarder</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492635#M84206</link>
      <description>&lt;P&gt;Yes, I retract my comment on the fishiness of the &lt;CODE&gt;script&lt;/CODE&gt; line; I don't do much powersehelling...&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 17:18:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492635#M84206</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-11-22T17:18:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to run basic PowerShell script on universal forwarder</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492636#M84207</link>
      <description>&lt;P&gt;@woodcock no worries. I thought using PowerShell would be more common but I'm finding not many customers use it with their UF.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 17:33:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492636#M84207</guid>
      <dc:creator>manderson_rr</dc:creator>
      <dc:date>2019-11-22T17:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to run basic PowerShell script on universal forwarder</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492637#M84208</link>
      <description>&lt;P&gt;Hi @manderson_rr,&lt;/P&gt;

&lt;P&gt;Ah yes, unfortunately some of the example schedules are incorrect.  How often would you like it to run?  Here's a handy site: &lt;A href="https://crontab.guru/"&gt;https://crontab.guru/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I can confirm that a number of customer are using the PowerShell modular input successfully.  O&amp;amp;;)&lt;/P&gt;

&lt;P&gt;Cheers,&lt;/P&gt;

&lt;P&gt;- Jo.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 20:44:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492637#M84208</guid>
      <dc:creator>jhornsby_splunk</dc:creator>
      <dc:date>2019-11-22T20:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to run basic PowerShell script on universal forwarder</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492638#M84209</link>
      <description>&lt;P&gt;@jhornsby_splunk  For now, I would like to run every minute.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 20:47:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492638#M84209</guid>
      <dc:creator>manderson_rr</dc:creator>
      <dc:date>2019-11-22T20:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to run basic PowerShell script on universal forwarder</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492639#M84210</link>
      <description>&lt;P&gt;Then use &lt;CODE&gt;* * * * *&lt;/CODE&gt;  but I think that is crazy....&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 20:56:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492639#M84210</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-11-22T20:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to run basic PowerShell script on universal forwarder</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492640#M84211</link>
      <description>&lt;P&gt;I would only use that example for 5-10 minutes, so I can troubleshoot and/or verify the output is being ingested. It will run every 60 minutes once it actually works.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 20:59:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492640#M84211</guid>
      <dc:creator>manderson_rr</dc:creator>
      <dc:date>2019-11-22T20:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to run basic PowerShell script on universal forwarder</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492641#M84212</link>
      <description>&lt;P&gt;Hi @manderson_rr,&lt;/P&gt;

&lt;P&gt;For maximum debugging, you can change &lt;CODE&gt;$logDebug&lt;/CODE&gt; to &lt;CODE&gt;$true&lt;/CODE&gt; in &lt;CODE&gt;splunk-powershell.ps1&lt;/CODE&gt;, which affects &lt;CODE&gt;splunk-powershell.ps1.log&lt;/CODE&gt;.  And you can also change &lt;CODE&gt;ExecProcessor&lt;/CODE&gt; (in &lt;CODE&gt;log.cfg&lt;/CODE&gt;) and &lt;CODE&gt;splunk-powershell&lt;/CODE&gt; (in &lt;CODE&gt;log-cmdline.cfg&lt;/CODE&gt;) to &lt;CODE&gt;DEBUG&lt;/CODE&gt;, which affects &lt;CODE&gt;splunkd.log&lt;/CODE&gt;.  You will need to restart the UF for the changes to take effect.  Maybe one of these logs will provide some clues as to what is going wrong.&lt;/P&gt;

&lt;P&gt;Cheers,&lt;/P&gt;

&lt;P&gt;- Jo.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 21:07:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492641#M84212</guid>
      <dc:creator>jhornsby_splunk</dc:creator>
      <dc:date>2019-11-22T21:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to run basic PowerShell script on universal forwarder</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492642#M84213</link>
      <description>&lt;P&gt;That's OK then.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2019 21:26:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-run-basic-PowerShell-script-on-universal-forwarder/m-p/492642#M84213</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-11-22T21:26:09Z</dc:date>
    </item>
  </channel>
</rss>

