Re: Log Off if network down
- From: "Jeremy" <jeremy@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 1 May 2007 20:27:57 +1000
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
.
- References:
- Re: Log Off if network down
- From: Stephen Bloomer
- Re: Log Off if network down
- Prev by Date: Re: Default Policy not applying
- Next by Date: Re: Default Policy not applying
- Previous by thread: Re: Log Off if network down
- Next by thread: Re: Password policy situation
- Index(es):
Relevant Pages
|
Loading