LISTING 3: logon.vbs Option Explicit On Error Resume Next Dim wshNetwork, wshShell, wshSysEnv, colDrives, nReturnCode Dim i, strDrive, strShare strDrive = "P:" strShare = "\\Compaq575\Public" Set wshNetwork = WScript.CreateObject("WScript.Network") Set wshShell = WScript.CreateObject("WScript.Shell") BEGIN CALLOUT A Set wshSysEnv = wshShell.Environment("SYSTEM") END CALLOUT A If (wshSysEnv("OS") = "Windows_NT") Then BEGIN CALLOUT B Set colDrives = wshNetwork.EnumNetworkDrives For i = 0 To colDrives.Count - 1 Step 2 If (colDrives(i) = strDrive) Then wshNetwork.RemoveNetworkDrive strDrive End If Next wshNetwork.MapNetworkDrive strDrive, strShare END CALLOUT B nReturnCode = wshShell.Run("net time /domain:" & wshNetwork.UserDomain & " /set /yes", 0, TRUE) If (nReturnCode <> 0) Then MsgBox "Unable to synchronize local clock." & vbNewLine &_ "Please call the Help desk at extension 1234.",_ 48,_ "WSH Logon Script Error" End If Else WScript.Echo "This WSH logon script supports only Windows NT." & vbNewLine & "Exiting..." Set wshNetwork = Nothing Set wshShell = Nothing WScript.Quit(1) End If Set wshNetwork = Nothing Set wshShell = Nothing WScript.Quit(nReturnCode)