Rocket Terminal Emulator

 View Only

 Question: Rocket TE Session Indicator increases (S1, S2, S3) after end task command

Michael Flores's profile image
Michael Flores posted 01-11-2023 19:15

Hi All,

I am having an issue after moving my VBA macro automations to new servers (Windows Server 2019) and am wondering if anybody can be of assistance. There are kill commands in my code that close out Rocket TE sessions, but when it opens new sessions, the identifiers at the top left have increased.

For example, if originally, 3 sessions were open, you would see session identifiers S1, S2, and S3 on their respective application windows. After the macro has closed out the tasks to move onto the next macro, and reopens the sessions, the sessions will instead be S4, S5, and S6 as if the initial 3 did not close "properly" and are still running via some background task. When I manually open a season and close it via the 'X' on the application window, this does not happen. I can close S1 and upon reopening, S1 is what will pop back open, which is what I need.

Is there some type of known issue when it comes to ending Rocket TE Sessions tasks using a certain method? If anyone knows how I can resolve this, I would be forever grateful. :)

Oddly, this issue persists even through restarting the server.

In case it is necessary, below is the code I am using to kill the sessions and host scripts.

Thanks,
M

Private Sub KillAllIBMSessions()

Dim oServ As Object
Dim cProc As Variant
Dim oProc As Object
    
    'StartIBMSession ("")
    'StartIBMSession ("")
    
    Set oServ = GetObject("winmgmts:")
    Set cProc = oServ.ExecQuery("Select * from Win32_Process where Name = 'bzmd.exe'")
            
    For Each oProc In cProc
        oProc.Terminate
    Next

End Sub


Private Sub KillHostScripts()
    Dim WMI As Object
    Dim AllProc As Variant
    Dim BZHostProc As Object
    
    Set WMI = GetObject("winmgmts:") 'WMI - Windows Management Instrumentation. Radha 2027_0701
    Set AllProc = WMI.ExecQuery("Select * from Win32_Process")
    
    For Each BZHostProc In AllProc
        'NOTE: It is CASE sensitive.
        If BZHostProc.Name = "bzsh.exe" Then
          BZHostProc.Terminate
        End If
    Next
    
    Set WMI = Nothing
    Set BZHostProc = Nothing
    Set AllProc = Nothing
    
End Sub
Zhi Li's profile image
ROCKETEER Zhi Li

Hello Michael,

When opening a session, Rocket TE Desktop stores its settings in the registry, kind of like locking this session, say S1,  until this session is closed normally and these settings will be cleaned from the registry at that point.  Your script uses WMI object to kill/terminate the session process (bzmd.exe), so bzmd.exe  will be exited abnormally therefore it has no chance to do clean work. In addition, similarly, if terminate the script host process (bzsh.exe) as above, it would cause the script can't exit as expected if some script is running. In a word, it's not recommend to terminate any RTE process in this way since it would easily cause data corruption or mess as you saw.

Hope this makes sense.

Thanks,

Zhi