Logon scripts should always be error trapped.

Post from Whirlpool:

when some users log on they get the following message but it is ok for other users
VBScript 807010B error.

PostLogon.vbs file contents are below
Set WshShell = CreateObject(“WScript.Shell”)
CMDFile = “cscript %logonserver%\something$\logonXP.vbs PostLogon”
WshShell.Run CMDFile, 0, True

can you please tell me which area i need to look at for fixing and get rid of this error?

Your help is highly appreciated.

There are a couple problems with this script:

  • there is an un-trapped error which a end-user gets to see.
  • WshShell is not set to Nothing when the script exists.
    sure wscript.quit should call a garbage collection, but it’s not good programming.
  • not capturing the result of the WshShell.Run CMDFile, 0, True statement.

Here was my suggested answer, which apparently helped:

(the area to look at) The directory path to logonXP.vbs for starters…

This vbscript code might help:
Set WshShell = CreateObject(“WScript.Shell”)
CMDFile = “cscript %logonserver%\something$\logonXP.vbs PostLogon”
On Error Resume Next
cmdfileresult = WshShell.Run (CMDFile, 0, True)
If cmdfileresult <> 0 Then
MsgBox CMDFile,,”Please tell the IT Guys”
End If
On Error GoTo 0

Which produces this error message when there is a problem:

(“Please tell the IT Guys” – is the important part)
Bookmark and Share