Advertisement
Guest User

Untitled

a guest
Feb 15th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. 'On Error Resume Next
  2.  
  3. Set objNetwork = CreateObject("WScript.Network")
  4. strUserName = objNetwork.UserName
  5. strComputer = objNetwork.ComputerName
  6. Set objNet = Nothing
  7.  
  8.  
  9.  
  10. 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
  11. Set objConn = CreateObject("ADODB.Connection")
  12. 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"
  13. Set objRs = objConn.Execute("SELECT * FROM tbl_LogonDetails WHERE UserName = '"& strUserName &"'")
  14.  
  15. If NOT objRs.EOF Then
  16. Set objShell = CreateObject("WScript.Shell")
  17. objConn.Execute("INSERT INTO tbl_FailedLogonLog Values ('"& strUserName &"','"& strComputer &"','"& FormatDateTime(Now(), 1) &" "& FormatDateTime(Now(),3) &"')")
  18.  
  19. objShell.Run "CMD /c echo " & Chr(7), 0, False
  20. objShell.Popup "You are already logged in on machine " & UCase(objRs("Workstation")),3 ,"Multiple Logins", 0
  21. objShell.Run "CMD /c echo y| ""logoff.exe""", 0, True
  22. Set objShell = Nothing
  23. Else
  24. objConn.Execute("INSERT INTO tbl_LogonDetails VALUES ('"& strUserName &"','"& strComputer &"','"& FormatDateTime(Now(), 1) &" "& FormatDateTime(Now(),3) &"')")
  25. End If
  26.  
  27. objRs.Close
  28. Set objRs = Nothing
  29. Set objConn = Nothing
  30. End If
  31.  
  32. WScript.Quit(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement