ConfigMgr 2007 MP – crash dumps monitor script failure


Continuing on the Configuration Manager 2007 Management Pack scripts failures I stumbled on another one. This time I had an "Invalid procedure call or argument’ 5 (0x5) executing script ConfigMgr 2007 Monitor SMS Executive Crash Dumps:

image

Digging inside the script I found another brilliant example of poor coding where once again a misplaced error checking in vbscript makes the script fail and return an obscure error message. btw this is the same error Fabrizio reported in an old post on QND (http://nocentdocent.wordpress.com/2009/07/19/configmgr-2007-crash-dumps-monitoring-sms-executive-script-error-permission-denied-70-0x46) even if this time the error has a different cause and resolution.

Sub OpenVarSet()     Dim oFSO     Dim oTempFolder     Dim oFile     Set g_oDictionary = CreateObject("Scripting.Dictionary")     Set oFSO = CreateObject("Scripting.FileSystemObject")     If 0 <> Err Then         ScriptError "create Scripting.FileSystemObject." & GetErrorString(Err)     Else         Set oTempFolder = oFSO.GetSpecialFolder(2)         If 0 <> Err Then             ScriptError "find the Temp directory." & GetErrorString(Err)         Else             Set oFile = oFSO.OpenTextFile(oTempFolder.Path & "\" & "t.vbs" & ".SCOM2007.VarSet", 1, True, -1)             If 0 <> Err Then                 ScriptError "open the '" & "t.vbs" & ".SCOM2007.VarSet' file in the Temp directory." & GetErrorString(Err)             Else             WScript.Echo oTempFolder.Path & "\" & "t.vbs" & ".SCOM2007.VarSet"                 Do Until oFile.AtEndOfStream                     Dim strLine, iBreak                     strLine = oFile.ReadLine()                     iBreak = Instr(strLine, vbTab)                     g_oDictionary.Add Left(strLine, iBreak - 1), Mid(strLine, iBreak + 1)                 Loop                 oFile.Close             End If         End If     End If
End Sub

The OpenVarSet Sub misses an ‘On error resume next’ statement, in absence of which all the error checking is useless.

Anyway, in this case the error was related to a corrupted VarSet file. The VarSet file is created in the default action account temporary folder, typically %windir%\Temp. If it contains a blank or truncated line the Left and Mid function calls are going to fail. You can safely delete the file to get rid of this error, it will be recreated on the next run.

- Daniele

This posting is provided "AS IS" with no warranties, and confers no rights.

About these ads
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 327 other followers

%d bloggers like this: