Morning/evening all,

Nice and easy question. I dont do much VBscripting, almost zero in fact. I just wanted to ask a question in regards to the below bit of code.

Will it return other error codes?
For example of the error/return code was 1603, will this be passed out?

Ive had a look around, but vb is jibberish to me - wish I learnt a coding lang at uni now.

Reason: this is for SCCM Task Sequences, the task seq engine dosent honour REALLYSUPPRESS - it just goes ahead a does it. Makes sense as it made for OS Deployment rather than software installing.

 Dim Retval 

' *** Install Application. ***
Dim WSHShell
Set WSHShell = WScript.CreateObject("WScript.Shell")

' open normal and don't wait
WSHShell.Run "notepad.exe", 1, True
Set WSHShell = Nothing

' *** show us what RETVAL is, unrem to see what retval = ***
MsgBox "The actual return code was " &retval

' *** unrem to set to 3010 for testing ***
'retval = 3010

If retval = 3010 Then
MsgBox "The return code was 3010, resetting to 0"
MsgBox "The actual return code was " &retval
End If

' *** set the return value to 0 anyway. ***
MsgBox "The return code was reset to 0"
Answer Summary:
2 Comments   [ + ] Show Comments


  • Spot on. WScript.Quit(some_value) will pass that back to whatever called the script. What it might do with that is another question! :-)
  • Gah, it kept returning 0 even though I know the exit should be 1624. Fixed it though!
    I was evaluating retval, but I didnt pipe(correct term?) "WSHShell.Run "notepad.exe", 1, True" into Retval.

    Like this:
    Retval = WSHShell.Run ("msiexec /i Blah.msi TRANSFORMS=DummyFileToFailInstall", 1, True)

    Thanks VBScab, thought you would be the one to answer (:
Please log in to comment



Answered by VBScab.

Answered 06/07/2013 by: rileyz
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity