'*** SET VARIABLES *** set fso = createobject("scripting.filesystemobject") Set WSHShell = WScript.CreateObject("WScript.Shell") simpleuname = wshshell.expandenvironmentstrings ("%USERNAME%") uname = "U_" & replace(simpleuname, "_", "x_") & "_" computername= "M_" & replace(wshshell.expandenvironmentstrings ("%COMPUTERNAME%"), "_", "x_") & "_" LockFilename = "\\servername\SingleLogin\"&uname&"-user---comp-"&computername&".lck" Const EWX_LOGOFF = 0 Const EWX_SHUTDOWN = 1 Const EWX_REBOOT = 2 Const EWX_FORCE = 4 Const EWX_POWEROFF = 8 Set Folder = fso.GetFolder("\\servername\SingleLogin\") Set Files = Folder.Files Dim File For Each File In Files strFiles=strFiles&","&File.Name Next if simpleuname <> "my_login_id" then if simpleuname <> "technician01" then if simpleuname <> "technician02" then if simpleuname <> "technician03" then if simpleuname <> "Generic Multiple Login Account" then if simpleuname <> "Digital_Signage" then if simpleuname <> "EPOS_Tills" then if simpleuname <> "other" then If InStr(strFiles, uname&"-user---comp-") Then 'BtnCode = WSHShell.Popup("You are already Logged in on another machine!", 3, "Logged In", 0 + 48) BtnCode = WSHShell.Popup("You are already Logged in on another machine!" & chr(13) & chr(13) & "If you need assistance with this please report to" & chr(13) & chr(13) & "The IT Services Technicians", 8, "Logged In", 400 + 48) Set wmi = GetObject("winmgmts:{(Shutdown)}") set objset = wmi.instancesof("win32_operatingsystem") for each obj in objset set os = obj : exit For next ' this one will do a *log off* (change EWX_LOGOFF ' with any of the other Const if needed os.win32shutdown EWX_LOGOFF wscript.quit else set myFile = fso.CreateTextFile(LockFilename, true) strNewLine = "Username : "&uname &" - Date/Time : "& NOW &" - Computername: "& computername myfile.WriteLine strNewLine myfile.Close end if end if end if end if end if end if end if end if End if