VBScripting Help - Easy
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
Retval=0
' *** 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"
else
MsgBox "The actual return code was " &retval
WScript.Quit(Retval)
End If
' *** set the return value to 0 anyway. ***
Retval=0
MsgBox "The return code was reset to 0"
WScript.Quit(Retval)
2 Comments
[ + ] Show comments
Answers (1)
Answer Summary:
Please log in to answer
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 (: - rileyz 11 years ago