Deployment Solution

 View Only

DS 6.9 SP2 VBScript Problem

  • 1.  DS 6.9 SP2 VBScript Problem

    Posted Apr 27, 2009 12:56 AM
    Is anyone else finding that scripts that ran under the previous version are no longer running? It's as-if 'On Error Resume Next' is being ignored (Even just commenting out the error-checking lines doesn't work). Thoughts and suggestions welcome.

    (Simplified) This is broken:
    ' Install Automatic Updates
    'vbscript
    On Error Resume Next
    Set objWSHShell = CreateObject("WScript.shell")
    If Err.Number Then WScript.Quit(Err.Number)
    postEvent "WScript.Shell object creation"
    Set objSystemInfo = CreateObject("Microsoft.Update.SystemInfo")
    postEvent "Microsoft.Update.SystemInfo object creation"
    If Err.Number Then WScript.Quit(Err.Number)
    blnRebootRequired = objSystemInfo.RebootRequired
    postEvent "System reboot pending check"
    If blnRebootRequired = True Then WScript.Quit(3010)
    WScript.Quit(99999)
    
    Sub postEvent(ByVal strMessage)
    	If CreateObject("Scripting.FileSystemObject").FileExists(".\WLogevent.exe") = True Then
    		objWSHShell.Run ".\WLogevent.exe -c:" & Err.Number & " -l:1 -ss:""" & strMessage & """", 1, True
    	End If
    End Sub
    
    But removing error-checking, this works:
    ' Install Automatic Updates
    'vbscript
    On Error Resume Next
    Set objWSHShell = CreateObject("WScript.shell")
    postEvent "WScript.Shell object creation"
    Set objSystemInfo = CreateObject("Microsoft.Update.SystemInfo")
    postEvent "Microsoft.Update.SystemInfo object creation"
    blnRebootRequired = objSystemInfo.RebootRequired
    postEvent "System reboot pending check"
    If blnRebootRequired = True Then WScript.Quit(3010)
    WScript.Quit(99999)
    
    Sub postEvent(ByVal strMessage)
    	If CreateObject("Scripting.FileSystemObject").FileExists(".\WLogevent.exe") = True Then
    		objWSHShell.Run ".\WLogevent.exe -c:" & Err.Number & " -l:1 -ss:""" & strMessage & """", 1, True
    	End If
    End Sub