When Windows 95, Windows 98, and Windows ME clients run a logon script, the client temporarily maps the last available drive letter to the NetLogon share on the Domain Controller that authenticated the user. This is usually drive letter Z:, but if a CD-ROM or some other device is configured to use drive letter Z:, the client will map Y: to NetLogon. The client runs the batch file specified as the logon script using this mapping. For example, if the user logon script is NetLogon.bat, the client will map Z: to the NetLogon share and run the program Z:\NetLogon.bat. After the batch file runs, the drive letter mapping is deleted. Windows NT, Windows 2000, and Windows XP clients use UNC to access the logon script, and do not use a temporary drive mapping.

A few network administrators have reported that the VBScript program launched by the logon script batch file fails to run. The client reports an error message to the effect that "the script file z:\Netlogon.vbs is not found". This usually happens sporadically. It is difficult to tell under what conditions this can occur, and many people report never seeing the problem. The best guess is that the client has deleted the drive mapping before the VBScript program could start. This only happens on Windows 95, Windows 98, and Windows ME clients.

The command processor executes the statements in a batch file one line at a time. This is why a batch file cannot delete itself, unless the delete statement is the last line. A VBScript program, however, like other executable programs, is loaded into memory and executes from memory. A VBScript program could delete itself and continue to run. The logon script batch file could have just the one line to run the VBScript program:

Start wscript %0\..\NetLogon.vbs

The batch file passes this statement to the command processor and exits. Before the Start command manages to start the wscript.exe program, and before the wscript program manages to load the file NetLogon.vbs, the client deletes the mapping to the NetLogon share. If the client maps drive Z: to the NetLogon share, then "%0" in the batch file will be interpreted as "z:\NetLogon.bat". The string "%0\..\NetLogon.vbs" becomes "z:\NetLogon.vbs". It doesn't matter whether Z: or %0 is used in the batch file, the program will fail to execute if the drive mapping is deleted before wscript can load NetLogon.vbs into memory.

The solution that seems to work when this problem is encountered is to add more statements to the logon script batch file. The statements should be added after the statement that launches the VBScript program. The drive mapping should not be deleted until all statements in the batch file complete. For example, you could add the following statement to the end of the logon script batch file:

dir c:\*.* /s > nul