Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'On Error Resume Next
- Set objNetwork = CreateObject("WScript.Network")
- strUserName = objNetwork.UserName
- strComputer = objNetwork.ComputerName
- Set objNet = Nothing
- If UCase(strUserName) <> "ADMINISTRATOR" AND UCase(strUserName) <> "LANGEXAM" AND UCase(strUserName) <> "STUDENT" AND UCase(strUserName) <> "exam02" AND UCase(strUserName) <> "WELCOME108" AND UCase(strUserName) <> "HYARE" AND UCase(strUserName) <> "PHYSICSLAPTOP" AND UCase(strUserName) <> "UCAS" AND UCase(strUsername) <> "LANGEXAM" AND UCase(strUsername) <> "GALILEO" Then
- Set objConn = CreateObject("ADODB.Connection")
- objConn.Open "Provider=SQLOLEDB.1;Password=ws234rf1q;Persist Security Info=True;User ID=rw_singlelogon;Initial Catalog=db_SingleLogon;Data Source=172.16.253.71"
- Set objRs = objConn.Execute("SELECT * FROM tbl_LogonDetails WHERE UserName = '"& strUserName &"'")
- If NOT objRs.EOF Then
- Set objShell = CreateObject("WScript.Shell")
- objConn.Execute("INSERT INTO tbl_FailedLogonLog Values ('"& strUserName &"','"& strComputer &"','"& FormatDateTime(Now(), 1) &" "& FormatDateTime(Now(),3) &"')")
- objShell.Run "CMD /c echo " & Chr(7), 0, False
- objShell.Popup "You are already logged in on machine " & UCase(objRs("Workstation")),3 ,"Multiple Logins", 0
- objShell.Run "CMD /c echo y| ""logoff.exe""", 0, True
- Set objShell = Nothing
- Else
- objConn.Execute("INSERT INTO tbl_LogonDetails VALUES ('"& strUserName &"','"& strComputer &"','"& FormatDateTime(Now(), 1) &" "& FormatDateTime(Now(),3) &"')")
- End If
- objRs.Close
- Set objRs = Nothing
- Set objConn = Nothing
- End If
- WScript.Quit(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement