<?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 Splunk Soar - Windows Remote Management - Custom Code in Run Script Shape in Splunk SOAR</title>
    <link>https://community.splunk.com/t5/Splunk-SOAR/Splunk-Soar-Windows-Remote-Management-Custom-Code-in-Run-Script/m-p/638893#M1154</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to utilize the following script (at the bottom) in the 'Run Script' shape in the Windows Remote Management app in Splunk Soar. This shape errors out due to curly braces used in the while loop and if statement along with the parameter {0} which will represent a Windows service.&amp;nbsp;&lt;/P&gt;&lt;P&gt;What are my options to get around the use of this curly brace? I've thought about using the custom code section, but I'm unsure how to set the script_str parameter without touching non-custom code. Attached is a screenshot detailing what I have with the custom code idea.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2023-04-05 15_17_55-PB _ Windows Restart Service.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/24799i8994230B619B6F26/image-size/large?v=v2&amp;amp;px=999" role="button" title="2023-04-05 15_17_55-PB _ Windows Restart Service.png" alt="2023-04-05 15_17_55-PB _ Windows Restart Service.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Script to verify the status of a Windows service, looping to check every 30 seconds for 15 minutes:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;$timeout = new-timespan -Minutes 15&lt;BR /&gt;$sw = [diagnostics.stopwatch]::StartNew()&lt;BR /&gt;$status&lt;BR /&gt;$success=0&lt;BR /&gt;while ($sw.Elapsed -lt $timeout -AND $success -eq 0){&lt;BR /&gt;$status = Get-Service "{0}" | select -ExpandProperty status&lt;BR /&gt;if ($status -contains "Stopped"){&lt;BR /&gt;$success = 1&lt;BR /&gt;}&lt;BR /&gt;start-sleep -seconds 30&lt;BR /&gt;}&lt;BR /&gt;write-output $success&lt;/P&gt;</description>
    <pubDate>Wed, 05 Apr 2023 20:32:50 GMT</pubDate>
    <dc:creator>whill</dc:creator>
    <dc:date>2023-04-05T20:32:50Z</dc:date>
    <item>
      <title>Splunk Soar - Windows Remote Management - Custom Code in Run Script Shape</title>
      <link>https://community.splunk.com/t5/Splunk-SOAR/Splunk-Soar-Windows-Remote-Management-Custom-Code-in-Run-Script/m-p/638893#M1154</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm trying to utilize the following script (at the bottom) in the 'Run Script' shape in the Windows Remote Management app in Splunk Soar. This shape errors out due to curly braces used in the while loop and if statement along with the parameter {0} which will represent a Windows service.&amp;nbsp;&lt;/P&gt;&lt;P&gt;What are my options to get around the use of this curly brace? I've thought about using the custom code section, but I'm unsure how to set the script_str parameter without touching non-custom code. Attached is a screenshot detailing what I have with the custom code idea.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2023-04-05 15_17_55-PB _ Windows Restart Service.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/24799i8994230B619B6F26/image-size/large?v=v2&amp;amp;px=999" role="button" title="2023-04-05 15_17_55-PB _ Windows Restart Service.png" alt="2023-04-05 15_17_55-PB _ Windows Restart Service.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Script to verify the status of a Windows service, looping to check every 30 seconds for 15 minutes:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;$timeout = new-timespan -Minutes 15&lt;BR /&gt;$sw = [diagnostics.stopwatch]::StartNew()&lt;BR /&gt;$status&lt;BR /&gt;$success=0&lt;BR /&gt;while ($sw.Elapsed -lt $timeout -AND $success -eq 0){&lt;BR /&gt;$status = Get-Service "{0}" | select -ExpandProperty status&lt;BR /&gt;if ($status -contains "Stopped"){&lt;BR /&gt;$success = 1&lt;BR /&gt;}&lt;BR /&gt;start-sleep -seconds 30&lt;BR /&gt;}&lt;BR /&gt;write-output $success&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2023 20:32:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-SOAR/Splunk-Soar-Windows-Remote-Management-Custom-Code-in-Run-Script/m-p/638893#M1154</guid>
      <dc:creator>whill</dc:creator>
      <dc:date>2023-04-05T20:32:50Z</dc:date>
    </item>
  </channel>
</rss>

