<?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: Splunk Powershell Scripted Alert in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/Splunk-Powershell-Scripted-Alert/m-p/131075#M2086</link>
    <description>&lt;P&gt;That won't help with an alert driven by a Splunk search. Today, the only options for an alert action are email or script. The resource kit is cool, though, as is the PowerShell addon, which every Splunk Windows shop needs to see &lt;A href="http://apps.splunk.com/app/1477/"&gt;http://apps.splunk.com/app/1477/&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 06 Nov 2013 17:17:34 GMT</pubDate>
    <dc:creator>halr9000</dc:creator>
    <dc:date>2013-11-06T17:17:34Z</dc:date>
    <item>
      <title>Splunk Powershell Scripted Alert</title>
      <link>https://community.splunk.com/t5/Alerting/Splunk-Powershell-Scripted-Alert/m-p/131072#M2083</link>
      <description>&lt;P&gt;I am trying to use a powershell scripted alert.&lt;/P&gt;

&lt;P&gt;I came up with the scripted alert &lt;/P&gt;

&lt;P&gt;call_powershell.bat&lt;/P&gt;

&lt;P&gt;which contains:&lt;BR /&gt;
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -File "E:\Program Files\Splunk\bin\scripts\Script1.ps1"&lt;/P&gt;

&lt;P&gt;the problem with this is that i don't seem to have access to the environmental variables to grab the attached csv for the results.&lt;/P&gt;

&lt;P&gt;anyone able to run a scripted powershell alert?&lt;/P&gt;

&lt;P&gt;thanks&lt;/P&gt;

&lt;P&gt;gd&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2013 16:43:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Splunk-Powershell-Scripted-Alert/m-p/131072#M2083</guid>
      <dc:creator>gdavid</dc:creator>
      <dc:date>2013-11-06T16:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Powershell Scripted Alert</title>
      <link>https://community.splunk.com/t5/Alerting/Splunk-Powershell-Scripted-Alert/m-p/131073#M2084</link>
      <description>&lt;P&gt;Your script should inherit the environment from the parent process. Try enumerating $env:, it's a special variable that contains the env vars. you would access it like this:&lt;/P&gt;

&lt;P&gt;$env:VarName&lt;/P&gt;

&lt;P&gt;So, to get your windows install folder, that would be $env:windir. There are many docs and posts about this topic, here's one: &lt;A href="http://technet.microsoft.com/en-us/library/ff730964.aspx"&gt;http://technet.microsoft.com/en-us/library/ff730964.aspx&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;HTH, let us know&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2013 17:12:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Splunk-Powershell-Scripted-Alert/m-p/131073#M2084</guid>
      <dc:creator>halr9000</dc:creator>
      <dc:date>2013-11-06T17:12:18Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Powershell Scripted Alert</title>
      <link>https://community.splunk.com/t5/Alerting/Splunk-Powershell-Scripted-Alert/m-p/131074#M2085</link>
      <description>&lt;P&gt;Have you used the Powershell resource kit that is referenced in this blog?&lt;/P&gt;

&lt;P&gt;&lt;A href="http://blogs.splunk.com/2012/02/04/powershell-resource-kit-for-splunk/"&gt;http://blogs.splunk.com/2012/02/04/powershell-resource-kit-for-splunk/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2013 17:12:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Splunk-Powershell-Scripted-Alert/m-p/131074#M2085</guid>
      <dc:creator>sdaniels</dc:creator>
      <dc:date>2013-11-06T17:12:48Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Powershell Scripted Alert</title>
      <link>https://community.splunk.com/t5/Alerting/Splunk-Powershell-Scripted-Alert/m-p/131075#M2086</link>
      <description>&lt;P&gt;That won't help with an alert driven by a Splunk search. Today, the only options for an alert action are email or script. The resource kit is cool, though, as is the PowerShell addon, which every Splunk Windows shop needs to see &lt;A href="http://apps.splunk.com/app/1477/"&gt;http://apps.splunk.com/app/1477/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2013 17:17:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Splunk-Powershell-Scripted-Alert/m-p/131075#M2086</guid>
      <dc:creator>halr9000</dc:creator>
      <dc:date>2013-11-06T17:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Powershell Scripted Alert</title>
      <link>https://community.splunk.com/t5/Alerting/Splunk-Powershell-Scripted-Alert/m-p/131076#M2087</link>
      <description>&lt;P&gt;Where did you pass the environment variables? the bat file should contain the "%SPLUNK_ARG_7%", "%SPLUNK_ARG_8%" which passes the csv /search id? I dont know how you are getting the result and emailing but this should be passed to .ps1 script to make any splunk result manipulation.&lt;/P&gt;

&lt;P&gt;Check with Splunk\bin\scripts echo.bat and try to work again.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 15:13:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Splunk-Powershell-Scripted-Alert/m-p/131076#M2087</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2020-09-28T15:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Powershell Scripted Alert</title>
      <link>https://community.splunk.com/t5/Alerting/Splunk-Powershell-Scripted-Alert/m-p/131077#M2088</link>
      <description>&lt;P&gt;Combining comment from @linu1988 and my answer should get you there.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Nov 2013 17:48:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Splunk-Powershell-Scripted-Alert/m-p/131077#M2088</guid>
      <dc:creator>halr9000</dc:creator>
      <dc:date>2013-11-06T17:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Powershell Scripted Alert</title>
      <link>https://community.splunk.com/t5/Alerting/Splunk-Powershell-Scripted-Alert/m-p/131078#M2089</link>
      <description>&lt;P&gt;This should be set in bat file.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;C:WindowsSystem32WindowsPowerShellv1.0powershell.exe -NoProfile -File "E:Program FilesSplunkbinscriptsScript1.ps1" "%SPLUNK_ARG_0%", "%SPLUNK_ARG_1%", "%SPLUNK_ARG_2%", "%SPLUNK_ARG_3%", "%SPLUNK_ARG_4%", "%SPLUNK_ARG_5%", "%SPLUNK_ARG_6%", "%SPLUNK_ARG_7%", "%SPLUNK_ARG_8%"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;then in ps script $args[i], as per need.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Nov 2013 18:26:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Splunk-Powershell-Scripted-Alert/m-p/131078#M2089</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2013-11-17T18:26:57Z</dc:date>
    </item>
  </channel>
</rss>

