'logon.vbs 'checks to see if user is already connected--if so, logs out 'otherwise--connects to course test manager Option Explicit Dim WshShell, WshEnvir, WshNetwork Set WshShell = WScript.CreateObject("WScript.Shell") Set WshEnvir = WshShell.Environment("Process") Set WshNetwork = WScript.CreateObject("WScript.Network") Dim sUser, nErrLevel, sTempFile sUser = WshEnvir("USERNAME") sTempFile = WshEnvir("TEMP") & "\OTHERPC.TXT" If WshShell.Run("\\madisona1\netlogon\ntname " & sUser & " >" & sTempFile,2,TRUE)=1 Then 'user already logged in Const ForReading = 1, ForWriting = 2, ForAppending = 3 Dim fs, f, sOtherPC Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.OpenTextFile(sTempFile, ForReading) WshShell.Popup sUser & " is already logged on to " & f.ReadAll,2,,16 f.Close WshShell.Run "\\madisona1\netlogon\logout" WScript.Quit End If WshNetwork.MapNetworkDrive "T:", "\\madisona1\ctm$" WScript.Quit