<?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 test powershell scripts with Splunk environment in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-test-powershell-scripts-with-Splunk-environment/m-p/586957#M103140</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/241632"&gt;@azun4i&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;yes you can manage a Powershell script as a scripted input, described in the above document.&lt;/P&gt;&lt;P&gt;In few words, you have to:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;put the script in the bin folder of an app,&lt;/LI&gt;&lt;LI&gt;create a stanza in inputs.conf to run your script to run the script with the frequency you want.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Usually Splunk is used to run a script that's already tested, but you could also use Splunk in testing.&lt;/P&gt;&lt;P&gt;About the use of system variables, I'm not sure, the only way is to test it.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Tue, 01 Mar 2022 09:50:22 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2022-03-01T09:50:22Z</dc:date>
    <item>
      <title>How to test powershell scripts with Splunk environment</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-test-powershell-scripts-with-Splunk-environment/m-p/586941#M103137</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;i am trying to create an add on that runs a powershell script to perform some actions. Since i dont want to hardcode a path i would like to access $SPLUNK_HOME within my powershell script.&lt;/P&gt;&lt;P&gt;afaik&amp;nbsp;$SPLUNK_HOME gets set as environment variable upon script start. so im using (get-item env:\SPLUNK_HOME).value&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to "test run" my scripts with a splunk environment set?&lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2022 08:16:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-test-powershell-scripts-with-Splunk-environment/m-p/586941#M103137</guid>
      <dc:creator>azun4i</dc:creator>
      <dc:date>2022-03-01T08:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to test powershell scripts with Splunk environment</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-test-powershell-scripts-with-Splunk-environment/m-p/586949#M103138</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/241632"&gt;@azun4i&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;di you already see this document&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Data/MonitorWindowsdatawithPowerShellscripts" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Data/MonitorWindowsdatawithPowerShellscripts&lt;/A&gt;&amp;nbsp;?&lt;/P&gt;&lt;P&gt;Anyway, answering to your question, you can use a relative path starting from the App home path.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2022 09:15:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-test-powershell-scripts-with-Splunk-environment/m-p/586949#M103138</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-03-01T09:15:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to test powershell scripts with Splunk environment</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-test-powershell-scripts-with-Splunk-environment/m-p/586950#M103139</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jeah that link is known to me, but it does not address my question&amp;nbsp; if it is possible to test a script by running it with splunk context.&lt;/P&gt;&lt;P&gt;&amp;nbsp;for the path issue, im well aware of the possibillities of eg&amp;nbsp;$PSScriptRoot and then adjusting path.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2022 09:22:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-test-powershell-scripts-with-Splunk-environment/m-p/586950#M103139</guid>
      <dc:creator>azun4i</dc:creator>
      <dc:date>2022-03-01T09:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to test powershell scripts with Splunk environment</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-test-powershell-scripts-with-Splunk-environment/m-p/586957#M103140</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/241632"&gt;@azun4i&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;yes you can manage a Powershell script as a scripted input, described in the above document.&lt;/P&gt;&lt;P&gt;In few words, you have to:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;put the script in the bin folder of an app,&lt;/LI&gt;&lt;LI&gt;create a stanza in inputs.conf to run your script to run the script with the frequency you want.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Usually Splunk is used to run a script that's already tested, but you could also use Splunk in testing.&lt;/P&gt;&lt;P&gt;About the use of system variables, I'm not sure, the only way is to test it.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2022 09:50:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-test-powershell-scripts-with-Splunk-environment/m-p/586957#M103140</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-03-01T09:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to test powershell scripts with Splunk environment</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-test-powershell-scripts-with-Splunk-environment/m-p/586962#M103141</link>
      <description>&lt;P&gt;i seem to have found an answer to my question:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;Test Scripts using Splunk CMD
To see the output of a script as if it was run by the Splunk system, use the following:
Mac:
/Applications/Splunk/bin/splunk cmd python
/Applications/Splunk/etc/apps/&amp;lt;your app&amp;gt;/bin/&amp;lt;your script&amp;gt;
Windows:
C:\Program Files\Splunk\bin\splunk.exe cmd C:\Program
Files\Splunk\etc\apps\&amp;lt;your app&amp;gt;\bin\&amp;lt;your script&amp;gt;
More useful command line tools to use with Splunk can be found here -&amp;gt;
http://docs.splunk.com/Documentation/Splunk/latest/Troubleshooting/CommandlinetoolsforusewithSupport&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;taken from:&amp;nbsp;&lt;A href="http://challenges.s3.amazonaws.com/splunk/Best%20Practices%20App%20building.pdf" target="_blank"&gt;http://challenges.s3.amazonaws.com/splunk/Best%20Practices%20App%20building.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2022 10:21:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-test-powershell-scripts-with-Splunk-environment/m-p/586962#M103141</guid>
      <dc:creator>azun4i</dc:creator>
      <dc:date>2022-03-01T10:21:52Z</dc:date>
    </item>
  </channel>
</rss>

