/build/static/layout/Breadcrumb_cap_w.png

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.

 

http://myitforum.com/cs2/blogs/nbrady/archive/2010/07/28/preventing-task-sequence-reboot-after-software-install-which-produces-a-3010-exit-code.aspx

 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
  • Spot on. WScript.Quit(some_value) will pass that back to whatever called the script. What it might do with that is another question! :-) - anonymous_9363 11 years ago
  • 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 (: - rileyz 11 years ago

Answers (1)

Answer Summary:
Posted by: rileyz 11 years ago
Red Belt
-1

Answered by VBScab.

 
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