Log a user off of system unless password is provided

Author Message
CaDoR

  • Total Posts : 1
  • Scores: 0
  • Reward points : 0
  • Joined: 3/22/2010
  • Status: offline
Log a user off of system unless password is provided Monday, March 22, 2010 11:07 PM (permalink)
0
So we have a problem in my office with people thinking because they have an account they can jump on any computer they want, so after a few days of searching i managed to put together this script, when it is placed in the start up folder of all users, it runs when someone logs on, and gives them 30 seconds to provide the password, if they dont they are logged off.  not certain this is really the right place for this, its an html app (.hta) but i thought other people may find it helpfull if they have this same problem.
 
       <Title>Security Alert </Title>
       <HTA:APPLICATION ID="Security trip" 
        SCROLL="No"     
        SCROLLFLAT ="No"  
        SingleInstance="Yes"   
        ShowInTaskbar="No"     
        SysMenu="No"    
        MaximizeButton="No"  
        MinimizeButton="No" 
        Border="None" 
        BORDERSTYLE ="complex" 
        INNERBORDER ="No"  
        Caption="No"    
        WINDOWSTATE="maximize"
        APPLICATIONNAME="Security trip"
        Icon="%SystemRoot%\explorer.exe">
     <STYLE type="text/css">
       BODY
        {
      Font-Size:10.25pt;
      Font-Weight:Bold;
      Font-Family:helvetica,verdana,arial;
      Color:#008040;
      BackGround-Color:Transparent;
      filter:progid:DXImageTransform.Microsoft.Gradient(StartColorStr='#E2E2E2',EndColorStr=' #6e6e6e);
      Margin-Top:0;
      Margin-Bottom:0;
      Margin-Left:0;
      Margin-Right:0;
      Padding-Top:0;
      Padding-Bottom:0;
      Padding-Left:0;
      Padding-Right:0;
      Text-Align:Center;
      Vertical-Align:Middle;
        }
       TD.Type1
        {
        Margin-Left:0;
        Padding-Left:0;
        }
       
     </STYLE>
      <script Language='VBSCRIPT'>
     Dim Password
     '->
     '->
     '->
     '->
     '->  SET PASSWORD HERE
     '->  
     '->
      Password = "1"
     '->
     '->
     '->
     '->
     '->
     '->
     Dim F1 :F1 = "<FONT STYLE='Font:8.25pt;Color:#002060;Font-Weight:Bold;'>"
     Dim idTimer
     Dim C1 :C1 = 30
     Dim D1 :D1 = 1
     '-> Button Varibles
     Dim ok
     '-> onload Action
        Function Window_onload()
      Counter()
     '-> Text line 1
      txt1.innerHTML = F1 & "Enter system password and click ok now or be logged off</FONT>"
      
     '-> Text line 2 
      txt2.innerHTML = F1 & "</FONT>"
        End Function
     '-> Count Down Function
        Function Counter()
      Do
       D1 = D1 -1 
       C1 = C1 -1 
       document.focus()
      ' Makes 1 Threw 9 Look like 01, 02 ETC
      If Len(C1) = 1 Then C1 = "0" & C1
      If Len(C1) = 2 Then C1 = C1
       txt3.innerHTML = F1 & "Remaining Time Before Auto Logoff    " & C1 & "</FONT>"
      Loop Until D1 = 0
       D1 = 1
      If C1 = 0 Then 
      Set objShell = CreateObject("Wscript.Shell")
             objShell.Run "shutdown.exe -L -F"
      End if
      idTimer = window.setTimeout("Counter", 1000, "VBScript")
      If ok = True Then
       ok_Go()
      End If  
      Exit Function
        End Function
     '-> Button Action
        Function Yes_Action()
      ok = True
        Exit Function
        End Function
     '-> Button Work
        Function ok_Go()
       txt3.innerHTML = Replace(F1,"002060","006020") & "Processing</FONT>"
      If Password = PasswordArea.Value then
       MsgBox "Logoff Aborted"
      elseif Password <> PasswordArea.Value then
       Set objShell = CreateObject("Wscript.Shell")
              objShell.Run "shutdown.exe -L -F"
      else
       Set objShell = CreateObject("Wscript.Shell")
              objShell.Run "shutdown.exe -L -F"
      end if
      window.clearTimeout(idTimer)
      idTimer = window.setTimeout("MyTimer1", 3000, "VBScript")
        Exit Function
        End Function
     '-> Close The HTA Window
        Function HtaExit() 
      window.clearTimeout(idTimer)
      If ok = True Then
       ok_Go()
      End If  
        End Function
     '-> Timer1
        Function MyTimer1()
      txt3.innerHTML = ""
      window.close()
      window.clearTimeout(idTimer)
        Exit Function
        End Function
     '-> Timer2
        Function MyTimer2()
      txt3.innerHTML = ""
      window.close()
      window.clearTimeout(idTimer)
        Exit Function
        End Function
      </SCRIPT>     <BODY Scroll='Yes'>     <table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
     <tr>
     <td align="center" valign="middle">
     <Center>
     <Table>
     <td align="center" valign="middle">
     <Table><TD Class='Type1'><Span ID='txt1'></span></TD></Table>
     <Table><TD Class='Type1'><Span ID='txt2'></Span></TD></Table>
     <Table><TD Class='Type1'><Span ID='txt3'></Span></TD></Table>
     <Table><TD><BR><input type="password" name="PasswordArea" size="30"></Table>
     <Table><TD><BUTTON ID='Bttn_Y' onclick='Yes_Action()'>OK</BUTTON></TD></Table>
     </Table>
     </Center>
     </td>
     </tr>
     </table>     </BODY>     

 
#1

    Online Bookmarks Sharing: Share/Bookmark

    Jump to:

    Current active users

    There are 0 members and 1 guests.

    Icon Legend and Permission

    • New Messages
    • No New Messages
    • Hot Topic w/ New Messages
    • Hot Topic w/o New Messages
    • Locked w/ New Messages
    • Locked w/o New Messages
    • Read Message
    • Post New Thread
    • Reply to message
    • Post New Poll
    • Submit Vote
    • Post reward post
    • Delete my own posts
    • Delete my own threads
    • Rate post

    2000-2012 ASPPlayground.NET Forum Version 3.9