<?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 Why am I unable to execute Powershell or batch alert scripts in Windows? in Alerting</title>
    <link>https://community.splunk.com/t5/Alerting/Why-am-I-unable-to-execute-Powershell-or-batch-alert-scripts-in/m-p/249662#M4673</link>
    <description>&lt;P&gt;Hello all,&lt;/P&gt;

&lt;P&gt;I can't seem to get Powershell or batch script to "successfully" execute.&lt;/P&gt;

&lt;P&gt;When I attempt to run a batch, I receive the following error in splunkd.log:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Error while executing script [Error 193] %1 is not a valid Win32 application
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In regards to a powershell script:&lt;/P&gt;

&lt;P&gt;If I attempt to run a ps1, even with &lt;CODE&gt;#!c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe&lt;/CODE&gt; as the first line, the exit code is seemed to be not &lt;CODE&gt;0&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Having changed/added the following to runshellscript.py:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Line 223: beneath the subprocess.popen call under &lt;CODE&gt;if mswindows:&lt;/CODE&gt; add: &lt;CODE&gt;output = p.stdout.read()&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Line 231: then under &lt;CODE&gt;if code!=0:&lt;/CODE&gt; modify &lt;CODE&gt;results = splunk.Intersplunk.generateErrorResults("Script: " + str(output))&lt;/CODE&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;I saw an error with runshellscript,py improperly escaping the arguments.  Having had a &lt;CODE&gt;|&lt;/CODE&gt; in my splunk query, runshellscript.py allowed the | to be treated as a command line pipe, not as part of the query.&lt;/P&gt;

&lt;P&gt;After removing the pipe from the splunk query (and restoring &lt;CODE&gt;runshellscript.py&lt;/CODE&gt; to it's original form), powershell seems to exit with code &lt;CODE&gt;0&lt;/CODE&gt;, but my script does not successfully execute/do anything observable.&lt;/P&gt;

&lt;P&gt;The scripts are as follows:&lt;/P&gt;

&lt;P&gt;tester.bat:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;@echo off
echo %SPLUNK_ARG_0% &amp;gt; "C:\program files\splunk\bin\scripts\testbat.out"
echo "bat started" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.out"
c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -file "C:\Program Files\Splunk\bin\scripts\tester.ps1" %*
echo "bat finishing" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.out"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;tester.ps1&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#!c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe
#docs.splunk.com/Documentation/Splunk/6.5.0/Alert/Configuringscriptedalerts
$scriptname = $Args[0]
$numberofeventsreturned = $Args[1]
$searchterms = $Args[2]
$fqquerystring = $Args[3]
$nameofreport = $Args[4]
$alerttriggerreason = $Args[5]
$reportbrowserurl = $Args[6]
$gzippedresultsfile = $Args[8]
write-output "start" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
write-output $($args -join ";")  &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
write-output "done" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I see some older documentation on Windows script execution in the following locations:&lt;BR /&gt;
&lt;A href="http://wiki.splunk.com/Community:TroubleshootingAlertScripts"&gt;http://wiki.splunk.com/Community:TroubleshootingAlertScripts&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.1/Alert/Configuringscriptedalerts"&gt;http://docs.splunk.com/Documentation/Splunk/6.5.1/Alert/Configuringscriptedalerts&lt;/A&gt;&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/171871/powershell-script-triggered-from-alert-is-not-exec.html"&gt;https://answers.splunk.com/answers/171871/powershell-script-triggered-from-alert-is-not-exec.html&lt;/A&gt; &amp;lt;== wish it was this simple&lt;/P&gt;

&lt;P&gt;However, none of the suggestions are of assistance, and it appears to be an issue directly related to how runshellscript,py is written.&lt;/P&gt;

&lt;P&gt;Has anyone had any success executing Alert scripts on Windows with Splunk v6.4.4?&lt;/P&gt;

&lt;P&gt;Thank you for your time,&lt;/P&gt;

&lt;P&gt;Matt&lt;/P&gt;</description>
    <pubDate>Mon, 28 Nov 2016 22:50:46 GMT</pubDate>
    <dc:creator>mbrownec</dc:creator>
    <dc:date>2016-11-28T22:50:46Z</dc:date>
    <item>
      <title>Why am I unable to execute Powershell or batch alert scripts in Windows?</title>
      <link>https://community.splunk.com/t5/Alerting/Why-am-I-unable-to-execute-Powershell-or-batch-alert-scripts-in/m-p/249662#M4673</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;

&lt;P&gt;I can't seem to get Powershell or batch script to "successfully" execute.&lt;/P&gt;

&lt;P&gt;When I attempt to run a batch, I receive the following error in splunkd.log:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Error while executing script [Error 193] %1 is not a valid Win32 application
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In regards to a powershell script:&lt;/P&gt;

&lt;P&gt;If I attempt to run a ps1, even with &lt;CODE&gt;#!c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe&lt;/CODE&gt; as the first line, the exit code is seemed to be not &lt;CODE&gt;0&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Having changed/added the following to runshellscript.py:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Line 223: beneath the subprocess.popen call under &lt;CODE&gt;if mswindows:&lt;/CODE&gt; add: &lt;CODE&gt;output = p.stdout.read()&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Line 231: then under &lt;CODE&gt;if code!=0:&lt;/CODE&gt; modify &lt;CODE&gt;results = splunk.Intersplunk.generateErrorResults("Script: " + str(output))&lt;/CODE&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;I saw an error with runshellscript,py improperly escaping the arguments.  Having had a &lt;CODE&gt;|&lt;/CODE&gt; in my splunk query, runshellscript.py allowed the | to be treated as a command line pipe, not as part of the query.&lt;/P&gt;

&lt;P&gt;After removing the pipe from the splunk query (and restoring &lt;CODE&gt;runshellscript.py&lt;/CODE&gt; to it's original form), powershell seems to exit with code &lt;CODE&gt;0&lt;/CODE&gt;, but my script does not successfully execute/do anything observable.&lt;/P&gt;

&lt;P&gt;The scripts are as follows:&lt;/P&gt;

&lt;P&gt;tester.bat:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;@echo off
echo %SPLUNK_ARG_0% &amp;gt; "C:\program files\splunk\bin\scripts\testbat.out"
echo "bat started" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.out"
c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe -file "C:\Program Files\Splunk\bin\scripts\tester.ps1" %*
echo "bat finishing" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.out"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;tester.ps1&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#!c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe
#docs.splunk.com/Documentation/Splunk/6.5.0/Alert/Configuringscriptedalerts
$scriptname = $Args[0]
$numberofeventsreturned = $Args[1]
$searchterms = $Args[2]
$fqquerystring = $Args[3]
$nameofreport = $Args[4]
$alerttriggerreason = $Args[5]
$reportbrowserurl = $Args[6]
$gzippedresultsfile = $Args[8]
write-output "start" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
write-output $($args -join ";")  &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
write-output "done" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I see some older documentation on Windows script execution in the following locations:&lt;BR /&gt;
&lt;A href="http://wiki.splunk.com/Community:TroubleshootingAlertScripts"&gt;http://wiki.splunk.com/Community:TroubleshootingAlertScripts&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.1/Alert/Configuringscriptedalerts"&gt;http://docs.splunk.com/Documentation/Splunk/6.5.1/Alert/Configuringscriptedalerts&lt;/A&gt;&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/171871/powershell-script-triggered-from-alert-is-not-exec.html"&gt;https://answers.splunk.com/answers/171871/powershell-script-triggered-from-alert-is-not-exec.html&lt;/A&gt; &amp;lt;== wish it was this simple&lt;/P&gt;

&lt;P&gt;However, none of the suggestions are of assistance, and it appears to be an issue directly related to how runshellscript,py is written.&lt;/P&gt;

&lt;P&gt;Has anyone had any success executing Alert scripts on Windows with Splunk v6.4.4?&lt;/P&gt;

&lt;P&gt;Thank you for your time,&lt;/P&gt;

&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 22:50:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Why-am-I-unable-to-execute-Powershell-or-batch-alert-scripts-in/m-p/249662#M4673</guid>
      <dc:creator>mbrownec</dc:creator>
      <dc:date>2016-11-28T22:50:46Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to execute Powershell or batch alert scripts in Windows?</title>
      <link>https://community.splunk.com/t5/Alerting/Why-am-I-unable-to-execute-Powershell-or-batch-alert-scripts-in/m-p/249663#M4674</link>
      <description>&lt;P&gt;Here's the deal.  Splunk support has confirmed that direct execution of powershell scripts is not supported by runshellscript.py.&lt;/P&gt;

&lt;P&gt;The "workaround" (not really a workaround as you'll see in a second) is to use a BATch script wrapper.&lt;/P&gt;

&lt;P&gt;Also, do not use positional arguments with BATch scripts, as there are escaping problems, use the set environmental variables.  Also, you must nest in double-quotes if you use a &lt;CODE&gt;|&lt;/CODE&gt; character in your search.&lt;/P&gt;

&lt;P&gt;Here is a test bat script that produces some verbose output for review:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;echo "%SPLUNK_ARG_0%" &amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt"
echo "%SPLUNK_ARG_1%" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt"
echo "%SPLUNK_ARG_2%" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt"
echo "%SPLUNK_ARG_3%" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt"
echo "%SPLUNK_ARG_4%" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt"
echo "%SPLUNK_ARG_5%" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt"
echo "%SPLUNK_ARG_6%" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt"
echo "%SPLUNK_ARG_8%" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt"
echo ---we are testing with two percent variables-- &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt"
echo %%1 &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt"
echo ---we are testing with one percent variables-- &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt"
echo %1 &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt"
echo %2 &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt"
echo %3 &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt"
echo %4 &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt"
echo %5 &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt"
echo %6 &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt"
echo %7 &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt"
echo %8 &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt"
echo ---we are testing with one percent variables embedded in single-quotes embedded in double quotes, semi-color separated-- &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt"
echo "'%0';'%1';'%2';'%3';'%4';'%5';'%6';'%7';'%8'"&amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt"
echo ---we are testing with asterisk-- &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt"
echo %* &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt"
echo ---execute powershell-- &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt"
powershell.exe -file "C:\Program Files\Splunk\bin\scripts\tester.ps1" "%SPLUNK_ARG_0%";"%SPLUNK_ARG_1%";"%SPLUNK_ARG_2%";"%SPLUNK_ARG_3%";"%SPLUNK_ARG_4%";"%SPLUNK_ARG_5%";"%SPLUNK_ARG_6%";"%SPLUNK_ARG_8%" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt" 2&amp;gt;&amp;amp;1 
echo Errorlevel = %errorlevel% &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\testbat.txt"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is the powershell script that's called within the above batch&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$args &amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
"--args[0]---------------" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
$args[0] &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
"--args[1]---------------" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
$args[1] &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
"--args[2]---------------" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
$args[2] &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
"--args[3]---------------" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
$args[3] &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
"--args[4]---------------" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
$args[4] &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
"--args[5]---------------" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
$args[5] &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
"--args[6]---------------" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
$args[6] &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
"--args[7]---------------" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
$args[7] &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
"--args[8]---------------" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
$args[8] &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
"--args[9]---------------" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
$args[9] &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
"--args[10]---------------" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
$args[10] &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
"--args[11]---------------" &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
$args[11] &amp;gt;&amp;gt; "C:\Program Files\Splunk\bin\scripts\test.csv"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Given the various issues I faced while passing the variables to the powershell script (escaping, etc), I found it best to rely on the powershell script to simply parse out a single argument... as is passed to the powershell script via the batch script call to powershell.exe.&lt;/P&gt;

&lt;P&gt;Here is the contents of the text file generated by the batch just so you see how weird escaping is (or lack there of):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"C:\Program Files\Splunk\bin\scripts\tester.bat" 
"1" 
"host="DAMEWARESERVER" sourcetype="WinEventLog:Application" SourceName=dwmrcs EventCode=111 | table _time host User_ID" 
"host="DAMEWARESERVER" sourcetype="WinEventLog:Application" SourceName=dwmrcs EventCode=111 | table _time host User_ID" 
"Dameware Connections" 
"Saved Search [Dameware Connections] number of events(1)" 
"http://SPLUNKSERVER:8000/app/search/@go?sid=scheduler__admin__search__RMD562ef57e39918d377_at_1481747700_13613" 
"C:\Program Files\Splunk\var\run\splunk\dispatch\scheduler__admin__search__RMD562ef57e39918d377_at_1481747700_13613\results.csv.gz" 
---we are testing with two percent variables-- 
%1 
---we are testing with one percent variables-- 
1 
"host^=^'DAMEWARESERVER^'^ sourcetype^=^'WinEventLog:Application^'^ SourceName^=dwmrcs^ EventCode^=111^ ^|^ table^ _time^ host^ User_ID" 
"host^=^'DAMEWARESERVER^'^ sourcetype^=^'WinEventLog:Application^'^ SourceName^=dwmrcs^ EventCode^=111^ ^|^ table^ _time^ host^ User_ID" 
"Dameware^ Connections" 
"Saved^ Search^ ^[Dameware^ Connections^]^ number^ of^ events^(1^)" 
"http://SPLUNKSERVER:8000/app/search/@go?sid^=scheduler__admin__search__RMD562ef57e39918d377_at_1481747700_13613" 
"" 
C:\Program 
---we are testing with one percent variables embedded in single-quotes embedded in double quotes, semi-color separated-- 
"'"C:\Program Files\Splunk\bin\scripts\tester.bat"';'1';'"host='DAMEWARESERVER' sourcetype='WinEventLog:Application' SourceName=dwmrcs EventCode=111 | table _time host User_ID"';'"host='DAMEWARESERVER' sourcetype='WinEventLog:Application' SourceName=dwmrcs EventCode=111 | table _time host User_ID"';'"Dameware Connections"';'"Saved Search [Dameware Connections] number of events(1)"';'"http://SPLUNKSERVER:8000/app/search/@go?sid=scheduler__admin__search__RMD562ef57e39918d377_at_1481747700_13613"';'""';'C:\Program'"
---we are testing with asterisk-- 
1  "host^=^'DAMEWARESERVER^'^ sourcetype^=^'WinEventLog:Application^'^ SourceName^=dwmrcs^ EventCode^=111^ ^|^ table^ _time^ host^ User_ID"  "host^=^'DAMEWARESERVER^'^ sourcetype^=^'WinEventLog:Application^'^ SourceName^=dwmrcs^ EventCode^=111^ ^|^ table^ _time^ host^ User_ID"  "Dameware^ Connections"  "Saved^ Search^ ^[Dameware^ Connections^]^ number^ of^ events^(1^)"  "http://SPLUNKSERVER:8000/app/search/@go?sid^=scheduler__admin__search__RMD562ef57e39918d377_at_1481747700_13613"  "" C:\Program Files\Splunk\var\run\splunk\dispatch\scheduler__admin__search__RMD562ef57e39918d377_at_1481747700_13613\results.csv.gz 
---execute powershell-- 
Errorlevel = 0 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And the powershell output:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;C:\Program Files\Splunk\bin\scripts\tester.bat;1;host=DAMEWARESERVER sourcetype=WinEventLog:Application SourceName=dwmrcs EventCode=111 | table _time host User_ID;host=DAMEWARESERVER sourcetype=WinEventLog:Application SourceName=dwmrcs EventCode=111 | table _time host User_ID;Dameware Connections;Saved Search [Dameware Connections] number of events(1);http://SPLUNKSERVER:8000/app/search/@go?sid=scheduler__admin__search__RMD562ef57e39918d377_at_1481747700_13613;C:\Program Files\Splunk\var\run\splunk\dispatch\scheduler__admin__search__RMD562ef57e39918d377_at_1481747700_13613\results.csv.gz
--args[0]---------------
C:\Program Files\Splunk\bin\scripts\tester.bat;1;host=DAMEWARESERVER sourcetype=WinEventLog:Application SourceName=dwmrcs EventCode=111 | table _time host User_ID;host=DAMEWARESERVER sourcetype=WinEventLog:Application SourceName=dwmrcs EventCode=111 | table _time host User_ID;Dameware Connections;Saved Search [Dameware Connections] number of events(1);http://SPLUNKSERVER:8000/app/search/@go?sid=scheduler__admin__search__RMD562ef57e39918d377_at_1481747700_13613;C:\Program Files\Splunk\var\run\splunk\dispatch\scheduler__admin__search__RMD562ef57e39918d377_at_1481747700_13613\results.csv.gz
--args[1]---------------
--args[2]---------------
--args[3]---------------
--args[4]---------------
--args[5]---------------
--args[6]---------------
--args[7]---------------
--args[8]---------------
--args[9]---------------
--args[10]---------------
--args[11]---------------
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Parse the semi-color separated &lt;CODE&gt;$args[0]&lt;/CODE&gt; with &lt;CODE&gt;-split&lt;/CODE&gt; or something else to determine the fields as described in the documentation: &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.1/Alert/Configuringscriptedalerts"&gt;http://docs.splunk.com/Documentation/Splunk/6.5.1/Alert/Configuringscriptedalerts&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2016 20:45:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Alerting/Why-am-I-unable-to-execute-Powershell-or-batch-alert-scripts-in/m-p/249663#M4674</guid>
      <dc:creator>mbrownec</dc:creator>
      <dc:date>2016-12-14T20:45:15Z</dc:date>
    </item>
  </channel>
</rss>

