box_l Posted June 4, 2008 Posted June 4, 2008 (edited) 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 Company Logon 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;} Welcome to Marlbrook Primary School Network Logon... User Name: Computer Name: Click to leave window open WebMail Links Enter Your Email Sign-In Name Click HERE for email policies QuickLinks http://www.yahooligans.com http://www.bbc.co.uk http://www.ajkids.com Click HERE for more Links newlogon2.vbs Edited June 4, 2008 by box_l wouldnt let me upload the htm file?
mhundley Posted July 15, 2008 Posted July 15, 2008 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
smadison Posted January 28, 2010 Posted January 28, 2010 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\CurrentVersion\Run] "check-home-dir"="C:\\WINDOWS\\vbs_logoff.vbs"
stratisphere Posted January 29, 2010 Posted January 29, 2010 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: 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?
chrisjako Posted August 11, 2010 Posted August 11, 2010 How do i use the ISmember command? Is it related to OU groups or security groups?
box_l Posted August 11, 2010 Author Posted August 11, 2010 In the newlogon2.vbs script 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
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now