Hi im currently trying to understand how to use returncode for error handling in a script.
Belov i have a script that install iff the registry key doenst exist.
The part i dont understand is this section. Anybody who could explain line by line what happening or point me to a site where i can read about this.
Thanks
ReturnCode = oShell.run (CHR(34) & sRunPath & "Prerequisite Components\Microsoft Report Viewer 2010\ReportViewer.exe" & CHR(34) & " /passive /norestart", 0, TRUE) If ReturnCode = 3010 Then ReturnCode = 0 If ReturnCode <> 0 Then Set oFSO = Nothing Set oShell = Nothing WScript.Quit(1)
End IF
' --- Microsoft Report Viewer 2010 x86 RegEntry = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{72DEBE5A-5667-3966-8E8D-2FD5FBCCB7DD}\UninstallString" If Not regEntryExists(RegEntry) Then ReturnCode = oShell.run (CHR(34) & sRunPath & "Prerequisite Components\Microsoft Report Viewer 2010\ReportViewer.exe" & CHR(34) & " /passive /norestart", 0, TRUE) If ReturnCode = 3010 Then ReturnCode = 0 If ReturnCode <> 0 Then Set oFSO = Nothing Set oShell = Nothing WScript.Quit(1) End If End If Function regEntryExists(RegEntry) Dim Entry On Error Resume Next 'set shell = CreateObject("WScript.Shell") Entry = oShell.RegRead(RegEntry) If Err.Number <> 0 then Err.Clear RegEntryExists = FALSE Else Err.Clear RegEntryExists = TRUE End If 'set oSshell = Nothing End Function
Helpdesk Supporter