/build/static/layout/Breadcrumb_cap_w.png

REXX Script

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
  • 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. - anonymous_9363 9 years ago
  • Well, I found one (!) but it ultimately talks to WMI which, I guess, your VBS does. - anonymous_9363 9 years ago
    • 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. - jhe 9 years ago
      • 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. - anonymous_9363 9 years ago
  • 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 - jhe 9 years ago
    • 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! - anonymous_9363 9 years ago
    • 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. - anonymous_9363 9 years ago
      • 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,. - jhe 9 years ago
  • https://msdn.microsoft.com/en-us/library/aa371564(v=vs.85).aspx - anonymous_9363 9 years ago

Answers (0)

Be the first to answer this question

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ