Re: Log Off if network down



If you can't get it to work in the context of the studnet's login, then I suggest you use the scheduled task and run it as SYSTEM and make it shutdown the computer instead of logging off. Use the -f option on the shutdown command to force running programs to close.

"Stephen Bloomer" <StephenBloomer@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:05C4D9B2-1C24-448F-B23A-818D8D8B7F67@xxxxxxxxxxxxxxxx
Thanks for the info. I was trying a script. The one below works on my
computer, but I have not been able to get it to work for the students.
Obviously something to do with permissions but I have not been able to get it
right. I will try and merge with yours and see what I get.

strComputer = "."

Set WshShell = WScript.CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\wmi")
Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
("Select * from MSNdis_StatusMediaDisconnect")

Do While True
Set strLatestEvent = colMonitoredEvents.NextEvent
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "%WINDIR%\system32\shutdown -s -t 20"
Loop

"Jeremy" wrote:

I'd use a Scheduled task to do this. You need to write a vbscript that
detects the link enabled or not on the ethernet connection then logs them
off if it detects it. Then schedule it to run every 5 minutes.

Here is a script I wrote to disable network cards with no link that you
might be able to adapt.

-->8
Option Explicit

'***Declare constants
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

'***Declare Variables
Dim strComputer
Dim objWMIService
Dim objShell
Dim objItem
Dim colItems

strComputer="."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set objShell = WScript.CreateObject("WScript.Shell")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter",
"WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)

For Each objItem In colItems
If (objItem.AdapterType="Ethernet 802.3") And (objItem.NetConnectionStatus
<> 2) Then
WScript.Echo "Disabling " & objItem.NetConnectionID
objShell.Run "devcon disable ""@" & objItem.PnpDeviceID,0,true
End If
Next

-->8

"Stephen Bloomer" <StephenBloomer@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:72ECA881-728A-4802-B486-BD103745F868@xxxxxxxxxxxxxxxx
> Is there a way for force a user to log off if there is no network
> connection?
> My users (students) are pulling the network cables out as the system is
> logging them in so they can play games etc. So I need a way of forcing
> them
> off when there is no network connetion.
>
> ANy advice appreaciated. Thanks
> Steve


.



Relevant Pages

  • Re: Log Off if network down
    ... I'd use a Scheduled task to do this. ... You need to write a vbscript that detects the link enabled or not on the ethernet connection then logs them off if it detects it. ... Dim objWMIService ... Set colItems = objWMIService.ExecQuery ...
    (microsoft.public.windows.group_policy)
  • RE: Need Help | Rolling out new App. | Trouble with some computers.
    ... Is the PC hard wired to the network or using wireless? ... Option Compare Database ... Dim varReturn As Variant ... Dim lngAuth As Long, strDept As String, strFirst As String, strLast As ...
    (microsoft.public.access.modulesdaovba)
  • RE: Network Connection Issue?
    ... Intermittent network problems can be very difficult to diagnose. ... Dim procCurrent as String ... Dim FileName as String ... 'time to open an Excel file; ...
    (microsoft.public.access.externaldata)
  • RE: Network Connection Issue?
    ... Intermittent network problems can be very difficult to diagnose. ... Dim procCurrent as String ... Dim FileName as String ... 'time to open an Excel file; ...
    (microsoft.public.access.externaldata)
  • Re: Remote Shutdown Batch Issue
    ... I initially wanted to have a scheduled task run on my server ... > calls on a list.txt of computers. ... > be easier to centralize the shutdown process on one server, ... Dim WshX ...
    (microsoft.public.windows.server.scripting)

Loading