Hi, Guys.

Is anyone here knows how to create a Rexx script that will detect a service and if it is detected the installation will not continue.

I have here a VB Script, but its not working in Radia. what I need is a Rexx Script. 

Below is my VB Script, does anybody know how to convert this to Rexx script if it is convertible?

Thanks!
******************************************************************************************************************************************************************8
On error resume next

Dim  objWMI, serviceList, colServiceList

Set WshShell = CreateObject("Wscript.Shell")
Set objWMI = GetObject("winmgmts:root\cimv2")

isService = "True"
Set colServiceList = objWMI.ExecQuery ("Select * from Win32_Service Where Name = 'M86_AUTH'")
if colServiceList.Count >= 1 Then
   isService = "False"
msgbox "Service is Installed, Installtion will stop!"
else
       isService = "True"  
      
   
End if
if (isService) Then
'##########################################################################
'## Install Application
'##########################################################################
MsgBox "Service is not Installed, Installtion will continue", 48,"Service"
strCommand = "msiexec /i" & scriptDir & "Authenticator-Service.msi TRANSFORMS=MicrosoftM86SecurityAuthenticator-3.0.5217.0.Mst /qn"
Log "running: " & strCommand
Return = WshShell.Run(strCommand, 1, True)
Log "command return code " & Return

If Return <> 0 and Return <> 3010 Then
Log "return code not 0 or 3010, not good, failed"
Wscript.Quit(Return)
End If    
end if

Wscript.quit
4 Comments   [ + ] Show Comments

Comments

  • Hmmm...I wonder how many samples of the world's 4,789,923rd most popular language would feature something like that? I fancy that it would be a quadzillion times easier to find out your VBS isn't working. So, to start with, have you got something less vague than "it's not working"? Have you added logging to the script so that you can get some output from it? If not, there are a couple of excellent class files that you can add to your VBS to give you comprehensive logging.
  • Well, I found one (!) but it ultimately talks to WMI which, I guess, your VBS does.
    • hello, my vbs is working when using it via system context or by PSEXEC, but for putting it in radia, it wont work because it is using system context.
      • Forgive me but isn't *everything* Radia does done in System context?

        And again, add logging to your script to determine *why* it's not working.
  • Hi, Below is my vb script. it's working via PSEXEC:

    On error resume next

    Dim objWMI, serviceList, colServiceList

    Set WshShell = CreateObject("Wscript.Shell")
    Set objWMI = GetObject("winmgmts:root\cimv2")

    isService = "True"
    Set colServiceList = objWMI.ExecQuery ("Select * from Win32_Service Where Name = 'M86_AUTH'")
    if colServiceList.Count >= 1 Then
    isService = "False"
    msgbox "Service is Installed, Installtion will stop!"
    else
    isService = "True"


    End if
    if (isService) Then
    '##########################################################################
    '## Install Application
    '##########################################################################
    MsgBox "Service is not Installed, Installtion will continue", 48,"Service"
    strCommand = "msiexec /i" & scriptDir & "Authenticator-Service.msi TRANSFORMS=MicrosoftM86SecurityAuthenticator-3.0.5217.0.Mst /qn"
    Log "running: " & strCommand
    Return = WshShell.Run(strCommand, 1, True)
    Log "command return code " & Return

    If Return <> 0 and Return <> 3010 Then
    Log "return code not 0 or 3010, not good, failed"
    Wscript.Quit(Return)
    End If
    end if

    Wscript.quit
    • Ditch the MsgBox statements and output the message text to a log file. Once you're happy with the code, port it over to your Radia system and re-run the test. The log file will at least tell you where the script is failing. Once you have *that* working, set about adding proper error-trapping to your code: it currently has none!
    • Wait, wait, wait! If your installation is an MSI, just add the service detection to the MSI! How? Do a registry search for the service name, setting a property to "INSTALLED" if it's present. Then add a LaunchCondition using that property. Easy.
      • The thing is, the customer doesn't have any previous version of the application. what they want is just to detect the "service" and if its running the installation will stop. if not the installation will continue. It will be easy for me if they have the previous installer so that I can get the registry,.
  • https://msdn.microsoft.com/en-us/library/aa371564(v=vs.85).aspx
Please log in to comment

There are no answers at this time

Answers

Answer this question or Comment on this question for clarity