cancel
Showing results for 
Search instead for 
Did you mean: 

"Runtime Resource Startup Retry Script" no window title

LudovicCOTTEZ-A
Level 4
Hello,

I would like to contact you following the analysis of the asset "Runtime Resource Startup Retry Script 1.0.0", I recovered the batch in the doc but I notice that my account only manages to recover the window title of the automate which launches correctly (for example "Blue Prism - Resource PC (Port 8184) - v7.0.1").

I did the test by launching a automate with a "/test" parameter that does not exist or emulate the window of the blocked automate, I have the following message "Invalid command-line argument '/test'" with window title "Blue Prism" (also found in the task manager).

However, when I run the command "tasklist /FI "imagename eq automate.exe" /fo list /v" it gives me the following result:
"Image Name: Automate.exe
PID: 4764
Session Name: RDP-Tcp#8
Session#: 5
Mem Usage: 102,904 K
Status: Running
User Name: XXXXX\XXXXX
CPU Time: 0:00:04
Window Title: Blue Prism - Resource PC (Port 8184) - v7.0.1

Image Name: Automate.exe
PID: 8048
Session Name: RDP-Tcp#8
Session#: 5
Mem Usage: 69,720 K
Status: Running
User Name: XXXXX\XXXXX
CPU Time: 0:00:01
Window Title: N/A"

I also tested with the following PowerShell command "get-process | Format-Table Id, Name, mainWindowtitle" which gives me :
4764 Automate Blue Prism - Resource PC (Port 8184) - v7.0.1
8048 Automate

Have you had this problem before ? I run the commands and automate with my admin account, not the system account.


------------------------------
Ludovic COTTEZ-ABRATE
------------------------------
4 REPLIES 4

ewilson
Staff
Staff
Hi @Ludovic COTTEZ-ABRATE,

I took a look at that script and there are a few things I would change about it. Below is an example of the revised script that I would use. I've added comments throughout that I think explain it pretty well, but I'm happy to answer any questions.

This script strips off the main part of the Window Title which means you don't have to worry about the port number or version info in the title.
It's also important to note that this script makes use of command extensions which are typically enabled by default, but in some organizations they prefer to turn those off.

Lastly, if you are running multiple runtime resources on a single machine (which I do in test environments) this script will terminate them all if even a single one is in an error condition. The thought there is that your startup batch script probably handles starting all of the RR's together.

@echo off
setlocal EnableExtensions
setlocal EnableDelayedExpansion

set RR_WINDOW_TITLE="Window Title: Blue Prism - Resource PC"

rem Loop through any instances of 'automate.exe'.
for /f "tokens=*" %%i in ('tasklist /FI "imagename eq automate.exe" /fo list /v ^| find "Window Title:"') do (
  rem Get the current window title.
  set CURRENT_WINDOW_TITLE=%%i
	
  if "!CURRENT_WINDOW_TITLE!"=="" (
    rem Not running, or not booted up yet, do nothing
  ) else (
    rem Extract the base portion of the window title. This allows us to bypass the specific port number 
    rem and software version information contained in the window title of a properly running Automate.exe instance.
    set STRIPPED_TITLE=!CURRENT_WINDOW_TITLE:~0,38!
		
    rem Perform a string comparison of the current window title and the standard runtime resource title defined above.	
    echo %RR_WINDOW_TITLE% | findstr /C:"!STRIPPED_TITLE!" 1>nul

    rem The comparison above will set the value of the errorlevel obect. If the errorlevel is 1, there was no match and 
    rem we found a Automate.exe window displaying an error message. If the errorlevel is 0, we had a match and found a 
    rem properly running and connected Automate.exe window.
    if errorlevel 1 (
      rem Failed to connect on first try, kill automate.exe, wait 5 secs, and start it again.
      taskkill /im automate.exe
      timeout 5 >nul
      start "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\rr_startup.bat"
    ) else (
      rem Running normally, disable the scheduled task that runs this batch script
      schtasks.exe /Change /TN "Run Check Automate" /DISABLE
    )
  )	
)

endlocal
endlocal
​

Cheers,

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

@Ludovic COTTEZ-ABRATE,

FWIW - I experienced the same behavior as you for cases where the runtime resource experienced an issue when starting. It comes down to the properties of the dialog that's shown for an error. It's not a normal window.

However, even in that case the revised code I pasted above will take care of the failed RR cases.

Cheers,


------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------

Hello,

Thank you for your feedback, in our setting we also use automate launched with the system account without us being able to do otherwise.

In your solution it will concider that the system account automate are in error every time.

Is there an alternative in this case ?

------------------------------
Ludovic COTTEZ-ABRATE
------------------------------

Hello @Ludovic COTTEZ-ABRATE,

I'm not sure I understand your statement. Regardless of what account started the runtime resource, the only reason it would be seen as in an error condition is if the error dialog was shown. Otherwise, if the runtime is started correctly and connects to the app server it will be shown as a regular window with a title that the DOS commands can capture.

If this doesn't work for you, you can always try reworking the logic using Powershell. I'm pretty sure all the same capabilities are there, but they're presented using different commands.

Cheers,


------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------