+ Post New Thread
Results 1 to 6 of 6
Scripts Thread, vbs logon with ie in Coding and Web Development; here is a logon script i use origionally from Mark Minasi's Reader Forum - VBS & IE Logon Script: but ...
  1. #1
    box_l's Avatar
    Join Date
    May 2007
    Location
    Herefordshire
    Posts
    403
    Thank Post
    63
    Thanked 84 Times in 69 Posts
    Rep Power
    60

    vbs logon with ie

    here is a logon script i use

    origionally from

    Mark Minasi's Reader Forum - VBS & IE Logon Script:

    but heavily edited by me.

    BoX

    also need this saved as .htm

    <html>
    <head>
    <title>Company Logon</title>
    <style type="text/css" media="all">
    body {margin:0px;padding:0px;background-color:#E3E8E3;
    font-family:font-family:Verdana,Arial,'Comic Sans MS';font-size:10pt;}
    td{font-size:10pt;color:black;font-weight:normal;}
    textarea{
    font-family:arial;font-size:8pt;font-weight:bold;
    color:#000000;padding-left:4px;}
    </style>
    </head>
    <body language="VBSCRIPT" SCROLL="no">
    <table width="100%" cellspacing="0" cellpadding="0" border="0">
    <tr width="100%">
    <td colspan="2" style="width:100%;text-align:center;background-color:#FFFFFF;padding-top:4px;border-bottom:2px solid dimgray;">
    <img border="0" src="http://www.edugeek.net/forums/scripts/EduTech_Logo_Blue_Transparent copy.jpg" width="123" height="75">
    <img border="0" src="http://www.edugeek.net/forums/scripts/Marlbrook logo2.jpg" width="150" height="150">
    <img border="0" src="http://www.edugeek.net/forums/scripts/Healthy-School-Logo.doc.jpg" width="123" height="75">

    </td>
    </tr>
    <tr>
    <td colspan="2" style="width:100%;padding-top:4px;text-align:center;font-size:12pt;
    font-weight:bold;font-family:font-family:'Comic Sans MS',Verdana,Arial;">
    Welcome to Marlbrook Primary School
    </td>
    </tr>
    <tr>
    <td colspan="2" style="width:100%;padding-top:2px;text-align:center;font-size:9pt;">
    Network Logon...
    </td>
    </tr>
    <tr>
    <td style="width:50%;padding-top:2px;padding-right:8px;text-align:right;">User Name:</td>
    <td style="width:50%;font-family:Verdana;font-weight:bold;" id="Msg1" name="Msg1"></td>
    </tr>
    <tr>
    <td style="width:50%;padding-top:2px;padding-right:8px;text-align:right;">Computer Name:</td>
    <td style="width:50%;"><font style="font-weight:bold;" id="Msg2" name="Msg2"></font></td>
    </tr>
    <tr>
    <td colspan="2" style="width:100%;padding-top:4px;text-align:center;">
    <marquee id="scrolling" name="scrolling" width="75%" height="16" style='font-size:9pt;color:dimgray;'></marquee>
    </td>
    </tr>
    <tr>
    <td colspan="2" style="text-align:center;padding-top:5px;">
    <textarea rows="12" id="wstatus" name="wstatus" cols="60"></textarea></td>
    </tr>
    <tr>
    <td colspan="2" style='padding-left:15px;padding-top:4px;font-size:8pt;font-weight:normal;font-family:Arial;Verdana;color:gray;'>
    <input language="VBSCRIPT" type="checkbox" name="holdit" id="holdit" checked=""></input>
    Click to leave window open
    </tr>

    <div align="center">
    <table border=0 width=100%>
    <tr bgcolor=#6666BB>
    <td> <font color=white face=verdana>WebMail </font></td>
    <td>&nbsp; </td>
    <td> <font color=white face=verdana>Links </font></td>
    </tr>
    <tr>

    <td> <script language="JavaScript">

    function checkKey(){
    if (window.event.keyCode == 13){
    window.event.keyCode = 0;
    sayHello("form1","http://2063-fs01/exchange");
    }
    }

    function sayHello(theForm, theUrl){
    // Define local variables and initialise
    var theUrl = theUrl;
    var theForm = eval("document." + theForm + "");
    var theUser = theForm.username.value;

    // Append username to url
    theUrl = theUrl + "/" + theUser;

    // load modified URL string into browser
    document.location = theUrl;
    }
    </script>
    <p align="right"><font color="#6666BB">Enter Your Email Sign-In Name</font> </p>
    <form name="form1" method="post" action="">
    <div align="right">


    <input type="text" name="username" size="20" maxlength="30" onKeypress=checkKey()>


    <input type="button" name="go" value="Go" onClick="sayHello('form1','http://intranet/exchange')">



    </div>
    <p align="right"><font color="#0033FF" size="2">Click <a href="http://www.edugeek.net/forums/scripts/EmailPolices.doc">HERE</a>
    for email policies</font></p>
    </form>

    <td>
    <div align="center"><img src="http://www.edugeek.net/forums/scripts/Logo.jpg" width="230" height="256">
    </div></td>
    <td>
    <p>&nbsp;</p>
    <p><font color="#0033FF">QuickLinks</font></p>
    <p><font color="#0033FF"><a href="http://www.yahooligans.com/">http://www.yahooligans.com</a></font></p>
    <p><font color="#0033FF"><a href="http://www.bbc.co.uk/">http://www.bbc.co.uk</a></font></p>
    <p><font color="#0033FF"><a href="http://www.ajkids.com/">http://www.ajkids.com</a></font></p>
    <p><font color="#0033FF" size="2">Click <a href="http://www.edugeek.net/forums/scripts/links.html">HERE</a>
    for more Links</font></p>
    <p>&nbsp;</p></td>
    </tr>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    </table>
    </div>
    <p>&nbsp;</p>
    </table>
    </body>
    </html>
    Attached Files Attached Files
    Last edited by box_l; 4th June 2008 at 09:35 PM. Reason: wouldnt let me upload the htm file?

  2. #2
    mhundley's Avatar
    Join Date
    Oct 2007
    Location
    Worcester
    Posts
    47
    Thank Post
    11
    Thanked 8 Times in 7 Posts
    Rep Power
    15

    Thumbs up

    Absolutely spot on, well done.

    I was wondering if it was possible to edit the vbs so that it closed after a short timeout(as it does now) if there were no errors, but either writing an error log to a file on the server or staying open with a message if one/all of the checks fail.

    I have very little idea of what to change as I have only just started looking into vb scripting but i'm sure that some of the clever people on here would be able to knock it up in a few minutes.

    Just thought it may help for when we get a message saying little johnny couldnt access his work/shared area but no-one actually knows which bit or why.

    Heres hoping.

    Marc

  3. #3
    smadison's Avatar
    Join Date
    Sep 2007
    Location
    UK
    Posts
    100
    Thank Post
    2
    Thanked 30 Times in 25 Posts
    Rep Power
    19
    Boxy as promised:

    'check for unplugged network cord during logon
    'checks for mapped drives
    'merge registry key to run
    '| Windows Registry Editor Version 5.00
    '| [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion\Run]
    '| "check-home-dir"="\"C:\\WINDOWS\\vbs_logoff.vbs\""
    'copy this vbs file to c:\windows directory

    Option Explicit ' Added By SM

    Dim objNetwork
    Dim strUserName
    Dim WshShell, WshNetwork, ObjFSO
    Dim intReturn

    Set objNetwork = CreateObject("WScript.Network")
    Set WshShell = CreateObject("WScript.Shell")
    Set WshNetwork = CreateObject("WScript.Network")
    Set ObjFSO = CreateObject("Scripting.FileSystemObject")

    ' Wait until the user is really logged in... Added by SM
    While StrUserName = ""
    WScript.Sleep 100 ' 1/10 th of a second
    StrUserName = WSHNetwork.UserName ' Get the user name
    Wend


    if strUserName = "Administrator" then
    'Ignore the admins ;-) Added By SM

    else

    'Check if the home drive is there... Added By SM
    if ObjFSO.DriveExists("W:") then

    'Yes it is bail out... Added By SM
    else
    'No its not, has the network cable been pulled... Added By SM

    intReturn = WshShell.Popup("Please ensure the network Cable is plugged in or the Wireless Button is on.", 8, "Login Error", 0)

    If intReturn = 1 Then ' Trap the button click... Added By SM

    'Wscript.Echo "You clicked the ok button. This would log you off"
    WshShell.Run "logoff.exe"

    Else ' The popup timedout log the user off... Added By SM

    'Wscript.Echo "The popup timed out. This would log you off after a timeout"
    WshShell.Run "logoff.exe"

    End If

    End if

    End if


    Reg key entry is:


    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Curr entVersion\Run]
    "check-home-dir"="C:\\WINDOWS\\vbs_logoff.vbs"

  4. #4
    stratisphere's Avatar
    Join Date
    Apr 2007
    Posts
    295
    Thank Post
    33
    Thanked 87 Times in 31 Posts
    Rep Power
    30
    Nice

    I had this issue a while back (the network plug being unplugged etc), kids were doing it after login to stop us remoting in etc. I found that the .Net framework as an event which is triggered when the network availability has changed:

    Code:
    System.Net.NetworkInformation.NetworkChange.NetworkAvailabilityChanged += new System.Net.NetworkInformation.NetworkAvailabilityChangedEventHandler(NetworkChange_NetworkAvailabilityChanged);
    
            void NetworkChange_NetworkAvailabilityChanged(object sender, System.Net.NetworkInformation.NetworkAvailabilityEventArgs e)
            {
                if (e.IsAvailable)
                {
                    // We're back on...
                    onNetworkConnected();
                }
                else
                {
                    // We've been unplugged... logout...
                    onNetworkDisconnected();
                }
            }
    I'll post a full C# example later which will sit in the background and watch if wanted?

  5. #5

    Join Date
    Sep 2007
    Posts
    107
    Thank Post
    8
    Thanked 2 Times in 2 Posts
    Rep Power
    14
    How do i use the ISmember command?

    Is it related to OU groups or security groups?

  6. #6
    box_l's Avatar
    Join Date
    May 2007
    Location
    Herefordshire
    Posts
    403
    Thank Post
    63
    Thanked 84 Times in 69 Posts
    Rep Power
    60
    In the newlogon2.vbs script

    Code:
    If IsMember("Admins") Then
    showstat("Mapping S: for Sims") 
      If Not MapDrive("S:", "\\server\sims") Then 
     showstat "Error, Unable to Map S: to Sims"
     End If 
     End if
    This 'Admins' is a security group

    BoX

SHARE:
+ Post New Thread

Similar Threads

  1. Pro Set Pre-logon
    By mattx in forum Wireless Networks
    Replies: 11
    Last Post: 15th September 2008, 11:16 AM
  2. Logon scripts
    By mmoseley in forum Windows
    Replies: 1
    Last Post: 23rd December 2007, 11:46 PM
  3. Logon times
    By wesleyw in forum How do you do....it?
    Replies: 4
    Last Post: 25th September 2006, 06:45 AM
  4. Yet another Logon Script
    By ajbritton in forum Windows
    Replies: 3
    Last Post: 19th June 2006, 09:47 AM
  5. Ctrl+Alt+Del at logon
    By Michael in forum Windows
    Replies: 6
    Last Post: 30th March 2006, 02:33 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •