<?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 get Session ID using command line options in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/How-to-get-Session-ID-using-command-line-options/m-p/67269#M19874</link>
    <description>It is possible to get the session id. But we have to use a BP Action to make it happen. The session ID is returned as part of the standard output when a command line is run from a BP Process. Here is something that I have working because we use this system to run processes that are listed in a specific order in a configuration file. I'm posting this here as it may help the community.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Step 1:&lt;/STRONG&gt; Run this&amp;nbsp; command line using the "Utility - Environment::Start Process Read Stderr and Stdout" . Here is an example command from my DEV setup:&lt;BR /&gt;&lt;BR /&gt;
&lt;P&gt;"/run ""Simple Child Process 1"" /resource MACHINE_NAME /user BP_User_Name BP_Password /startp ""&amp;lt;inputs&amp;gt; &amp;lt;input name='Text Parameter' type='text' value='" &lt;STRONG&gt;&amp;amp;&lt;/STRONG&gt; &lt;STRONG&gt;[&lt;/STRONG&gt;Text Param 1&lt;STRONG&gt;]&lt;/STRONG&gt; &lt;STRONG&gt;&amp;amp;&lt;/STRONG&gt; "' /&amp;gt;&amp;lt;input name='Numeric Parameter' type='number' value='" &lt;STRONG&gt;&amp;amp;&lt;/STRONG&gt; &lt;STRONG&gt;[&lt;/STRONG&gt;Num Param 2&lt;STRONG&gt;]&lt;/STRONG&gt; &lt;STRONG&gt;&amp;amp;&lt;/STRONG&gt; "' /&amp;gt;&amp;lt;/inputs&amp;gt;"""&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="17560.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/17714i9543484DBAE0DF65/image-size/large?v=v2&amp;amp;px=999" role="button" title="17560.png" alt="17560.png" /&gt;&lt;/span&gt;&lt;/P&gt;
This action returns command line output into two output variables Standard Output and Standard Error. Map these two variables to standard BP Data items.&amp;nbsp; Once the command runs successfully, the Standard Output data item will have an output that typically looks like this and contains the session id of the target process:&lt;BR /&gt;&lt;BR /&gt;
&lt;P&gt;&lt;EM&gt;Started process:Simple Child Process 1&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Resource: MACHINE_NAME&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Actual resource: MACHINE_NAME&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Session:&lt;STRONG&gt;1c778a54-1af6-4eab-a772-20687af0ab11&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;BR /&gt;&lt;STRONG&gt;Step 2:&lt;/STRONG&gt; Extract the Session ID using the RegEx utility (or string parsing) into a local variable. It would be safe to add a Trim(SESSION_ID) to remove the trailing line break. Otherwise you will be spending hours trying to figure out why subsequent command lines don't work!&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="17561.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/17712i4DA06874A9AF007C/image-size/large?v=v2&amp;amp;px=999" role="button" title="17561.png" alt="17561.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;The next step is to confirm that you process has completed before calling /getlog&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Step 3:&lt;/STRONG&gt;&amp;nbsp; In this case, I set up a Decision Loop with a timeout to wait for the Session status to go from "Running" to "Completed"&lt;BR /&gt;Again, I use the "Utility - Environment::Start Process Read Stderr and Stdout" to run this following command line and fetch the session status:&lt;BR /&gt;&lt;BR /&gt;
&lt;P&gt;"/status " &lt;STRONG&gt;&amp;amp;&lt;/STRONG&gt; Trim&lt;STRONG&gt;([SESSION_ID&lt;/STRONG&gt;&lt;STRONG&gt;]&lt;/STRONG&gt;&lt;STRONG&gt;)&lt;/STRONG&gt; &lt;STRONG&gt;&amp;amp;&lt;/STRONG&gt; " /user BP_User_Name BP_Password"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;As before, extract the sessions status using RegEx. Break the loop when the status changes from "Running" to "Completed" (or when it times out in which case it's a failure scenario).&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Step 4: Finally, use the /getlog switch to get the log from the session ID like so:&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;"/getlog " &lt;STRONG&gt;&amp;amp;&lt;/STRONG&gt; Trim&lt;STRONG&gt;([&lt;/STRONG&gt;Session ID&lt;STRONG&gt;]&lt;/STRONG&gt;&lt;STRONG&gt;)&lt;/STRONG&gt; &lt;STRONG&gt;&amp;amp;&lt;/STRONG&gt; " /user BP_User_Name BP_Password "&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Something to note:&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;It may be an issue with my BP installation. The /getlog in my case is unable to return the output parameters returned by the target process. Instead it just outputs simple log lines. I have raised a ticket with BP to address this issue.&lt;/P&gt;
Thanks and I hope this helps.&lt;BR /&gt;-Andy&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Prashanth (Andy) Menon&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
    <pubDate>Tue, 31 Jan 2023 07:03:00 GMT</pubDate>
    <dc:creator>andymenon</dc:creator>
    <dc:date>2023-01-31T07:03:00Z</dc:date>
    <item>
      <title>How to get Session ID using command line options</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-get-Session-ID-using-command-line-options/m-p/67266#M19871</link>
      <description>Hi All,&lt;BR /&gt;I tries to call the &lt;A href="https://bpdocs.blueprism.com/bp-6-7/en-us/helpCommandLine.htm?Highlight=automatec.exe%20/export#" class="MCDropDownHotSpot dropDownHotspot MCDropDownHotSpot_ MCHotSpotImage" aria-expanded="true" aria-controls="mc-dropdown-bodyb6dbd0f1-fcb5-478a-8c56-5d15393f813a" role="button" target="_blank" rel="noopener"&gt;/getlog &amp;lt;sessionid&amp;gt;&lt;/A&gt; to get the log of the session using Command line options (AutomateC.exe), This function requires session id as a parameter,&amp;nbsp; Can you explain me how can I get the session id of the existing session ?&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Victor C&lt;BR /&gt;Associate&lt;BR /&gt;Cognizant&lt;BR /&gt;Asia/Kolkata&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Mon, 12 Dec 2022 15:40:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-get-Session-ID-using-command-line-options/m-p/67266#M19871</guid>
      <dc:creator>VictorC</dc:creator>
      <dc:date>2022-12-12T15:40:00Z</dc:date>
    </item>
    <item>
      <title>RE: How to get Session ID using command line options</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-get-Session-ID-using-command-line-options/m-p/67267#M19872</link>
      <description>As far as I know, the CLI commands cannot determine the session ID unless the session was started from command line using, for example, /run &amp;lt;processname&amp;gt;. That returns a session ID.
&lt;DIV style="position: absolute; display: none; z-index: 16777271;"&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Dave Morris&lt;BR /&gt;3Ci at Southern Company&lt;BR /&gt;Atlanta, GA&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Mon, 12 Dec 2022 16:21:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-get-Session-ID-using-command-line-options/m-p/67267#M19872</guid>
      <dc:creator>david.l.morris</dc:creator>
      <dc:date>2022-12-12T16:21:00Z</dc:date>
    </item>
    <item>
      <title>RE: How to get Session ID using command line options</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-get-Session-ID-using-command-line-options/m-p/67268#M19873</link>
      <description>&lt;a href="https://community.blueprism.com/t5/user/viewprofilepage/user-id/20150"&gt;@VictorC&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;If you know the specific runtime resource that's running the process you can use the &lt;A href="https://bpdocs.blueprism.com/bp-7-1/en-us/helpHTTPInterface.htm" target="_blank" rel="noopener"&gt;HTTP interface&lt;/A&gt; and &lt;A href="https://bpdocs.blueprism.com/bp-7-1/en-us/helpResourcePCCommands.htm" target="_blank" rel="noopener"&gt;resource PC commands&lt;/A&gt; of the resource PC to get the active session ID.​ If you're on BP v7 or later, and you've deployed the REST API, you can use it to get session information.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Eric Wilson&lt;BR /&gt;Director, Integrations and Enablement&lt;BR /&gt;Blue Prism Digital Exchange&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Mon, 12 Dec 2022 17:11:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-get-Session-ID-using-command-line-options/m-p/67268#M19873</guid>
      <dc:creator>ewilson</dc:creator>
      <dc:date>2022-12-12T17:11:00Z</dc:date>
    </item>
    <item>
      <title>RE: How to get Session ID using command line options</title>
      <link>https://community.blueprism.com/t5/Product-Forum/How-to-get-Session-ID-using-command-line-options/m-p/67269#M19874</link>
      <description>It is possible to get the session id. But we have to use a BP Action to make it happen. The session ID is returned as part of the standard output when a command line is run from a BP Process. Here is something that I have working because we use this system to run processes that are listed in a specific order in a configuration file. I'm posting this here as it may help the community.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Step 1:&lt;/STRONG&gt; Run this&amp;nbsp; command line using the "Utility - Environment::Start Process Read Stderr and Stdout" . Here is an example command from my DEV setup:&lt;BR /&gt;&lt;BR /&gt;
&lt;P&gt;"/run ""Simple Child Process 1"" /resource MACHINE_NAME /user BP_User_Name BP_Password /startp ""&amp;lt;inputs&amp;gt; &amp;lt;input name='Text Parameter' type='text' value='" &lt;STRONG&gt;&amp;amp;&lt;/STRONG&gt; &lt;STRONG&gt;[&lt;/STRONG&gt;Text Param 1&lt;STRONG&gt;]&lt;/STRONG&gt; &lt;STRONG&gt;&amp;amp;&lt;/STRONG&gt; "' /&amp;gt;&amp;lt;input name='Numeric Parameter' type='number' value='" &lt;STRONG&gt;&amp;amp;&lt;/STRONG&gt; &lt;STRONG&gt;[&lt;/STRONG&gt;Num Param 2&lt;STRONG&gt;]&lt;/STRONG&gt; &lt;STRONG&gt;&amp;amp;&lt;/STRONG&gt; "' /&amp;gt;&amp;lt;/inputs&amp;gt;"""&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="17560.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/17714i9543484DBAE0DF65/image-size/large?v=v2&amp;amp;px=999" role="button" title="17560.png" alt="17560.png" /&gt;&lt;/span&gt;&lt;/P&gt;
This action returns command line output into two output variables Standard Output and Standard Error. Map these two variables to standard BP Data items.&amp;nbsp; Once the command runs successfully, the Standard Output data item will have an output that typically looks like this and contains the session id of the target process:&lt;BR /&gt;&lt;BR /&gt;
&lt;P&gt;&lt;EM&gt;Started process:Simple Child Process 1&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Resource: MACHINE_NAME&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Actual resource: MACHINE_NAME&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Session:&lt;STRONG&gt;1c778a54-1af6-4eab-a772-20687af0ab11&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;BR /&gt;&lt;STRONG&gt;Step 2:&lt;/STRONG&gt; Extract the Session ID using the RegEx utility (or string parsing) into a local variable. It would be safe to add a Trim(SESSION_ID) to remove the trailing line break. Otherwise you will be spending hours trying to figure out why subsequent command lines don't work!&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="17561.png"&gt;&lt;img src="https://community.blueprism.com/t5/image/serverpage/image-id/17712i4DA06874A9AF007C/image-size/large?v=v2&amp;amp;px=999" role="button" title="17561.png" alt="17561.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;The next step is to confirm that you process has completed before calling /getlog&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Step 3:&lt;/STRONG&gt;&amp;nbsp; In this case, I set up a Decision Loop with a timeout to wait for the Session status to go from "Running" to "Completed"&lt;BR /&gt;Again, I use the "Utility - Environment::Start Process Read Stderr and Stdout" to run this following command line and fetch the session status:&lt;BR /&gt;&lt;BR /&gt;
&lt;P&gt;"/status " &lt;STRONG&gt;&amp;amp;&lt;/STRONG&gt; Trim&lt;STRONG&gt;([SESSION_ID&lt;/STRONG&gt;&lt;STRONG&gt;]&lt;/STRONG&gt;&lt;STRONG&gt;)&lt;/STRONG&gt; &lt;STRONG&gt;&amp;amp;&lt;/STRONG&gt; " /user BP_User_Name BP_Password"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;As before, extract the sessions status using RegEx. Break the loop when the status changes from "Running" to "Completed" (or when it times out in which case it's a failure scenario).&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Step 4: Finally, use the /getlog switch to get the log from the session ID like so:&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;"/getlog " &lt;STRONG&gt;&amp;amp;&lt;/STRONG&gt; Trim&lt;STRONG&gt;([&lt;/STRONG&gt;Session ID&lt;STRONG&gt;]&lt;/STRONG&gt;&lt;STRONG&gt;)&lt;/STRONG&gt; &lt;STRONG&gt;&amp;amp;&lt;/STRONG&gt; " /user BP_User_Name BP_Password "&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Something to note:&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;It may be an issue with my BP installation. The /getlog in my case is unable to return the output parameters returned by the target process. Instead it just outputs simple log lines. I have raised a ticket with BP to address this issue.&lt;/P&gt;
Thanks and I hope this helps.&lt;BR /&gt;-Andy&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;Prashanth (Andy) Menon&lt;BR /&gt;------------------------------&lt;BR /&gt;</description>
      <pubDate>Tue, 31 Jan 2023 07:03:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/How-to-get-Session-ID-using-command-line-options/m-p/67269#M19874</guid>
      <dc:creator>andymenon</dc:creator>
      <dc:date>2023-01-31T07:03:00Z</dc:date>
    </item>
  </channel>
</rss>

