Re: getting users to logoff
- From: Computerguy <phil2627@xxxxxxxxx>
- Date: Mon, 21 Jan 2008 10:41:30 -0800 (PST)
On Jan 17, 12:34 pm, "Mathieu CHATEAU" <gollum...@xxxxxxx> wrote:
Here is the vbscript.
Hopes that newsgroups reader won't kill the carrier returns...
Just change:
ou=Mystations,dc=mydomain,dc=com to match your OU.
C:\Scripts\LogOff\LogOff.log to a correct path for the log.
This will logoff users on workstations
Const ForWriting = 2
strComputerContainer = "ou=Mystations,dc=mydomain,dc=com"
Set objContainer = GetObject("LDAP://" & strComputerContainer)
objContainer.Filter = Array("Computer")
Set objFSO = CreateObject ("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile ("C:\Scripts\LogOff\LogOff.log",
ForWriting)
Set StdOut = WScript.StdOut
Set objShell = CreateObject("WScript.Shell")
On Error Resume Next
For Each objComputer In objContainer
strComputer = Split(objComputer.Name, "=")(1)
Set objScriptExec = objShell.Exec("ping " & strComputer)
strPingResults = LCase(objScriptExec.StdOut.ReadAll)
objFile.Write (Now & VbCrLf)
If InStr(strPingResults, "reply from") Then
objFile.Write ("Ping " & strComputer & " OK" & VbCrLf)
Err.Clear
Set objWMIService = GetObject("winmgmts:" & _
"{impersonationLevel=Impersonate}!\\" & strComputer & "\root\cimv2")
If Err.Number Then
objFile.Write ("Acces WMI " & strComputer & " Error" & VbCrLf)
objFile.Write ("Type d'Erreur : " & Err.Number & ": " & Err.Description &
VbCrLf)
Err.Clear
Else
Const SHUTDOWN = 4
objFile.Write ("Acces WMI " & strComputer & " OK" & VbCrLf)
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(shutdown)}!\\" & strComputer &
"\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("SELECT * FROM Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
ObjOperatingSystem.Win32Shutdown(SHUTDOWN)
Next
End If
Else
objFile.Write ("Ping " & strComputer & " Error" & VbCrLf)
End If
Next
objFile.Close
--
Cordialement,
Mathieu CHATEAU
English blog:http://lordoftheping.blogspot.com
French blog:http://www.lotp.fr
"Computerguy" <phil2...@xxxxxxxxx> wrote in message
news:43d4a82b-b658-427b-a9bb-c7e9eef2a901@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Jan 14, 1:45 pm, "Mathieu CHATEAU" <gollum...@xxxxxxx> wrote:
Hello,
this is not really a security issue, but more a functionnal issue.
Roaming profile won't get updated, as it is updated at logoff.
We use a vbscript to reboot stations, which force logoff on the way.
You may change the code to only logoff without shutting down the pc
Are you intereseted in ?
--
Cordialement,
Mathieu CHATEAU
English blog:http://lordoftheping.blogspot.com
French blog:http://www.lotp.fr
"Computerguy" <phil2...@xxxxxxxxx> wrote in message
news:3f7cd77b-bb0f-42c5-a1cb-d5235b4495bf@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Is there any security threat to the following ?
- windows xp2 is locked (have to enter Ctrl+Alt+Del)
- servers setup to disconnect users at 10:00 PM
For electricity savings reasons we are starting to request users
logoff and shutdown at the end of the day. Right now we have users
who forget to logoff, but their PC will go to the Windows XP locked
screen. If we are in the wrong forum please let us know to repost.
Thanks.- Hide quoted text -
- Show quoted text -
Mr. Chateau,
We are interested in anything to get staff to exit the network. I
almost forget we have files synching at logoff to their directory and
if they never logoff..... We have Altiris and tried assigning a job
to restart at 10:00 PM, but when users do shutdown they would come in
the next day and after powering on the computer they are greeted by
the same shutdown job that powers off their computer. At first we
were looking for software. We would welcome a script to somehow
remove users from the network at a certain time.- Hide quoted text -
- Show quoted text -
Thank you, we will give it a try. Much appreciated.
.
- References:
- getting users to logoff
- From: Computerguy
- Re: getting users to logoff
- From: Mathieu CHATEAU
- Re: getting users to logoff
- From: Computerguy
- Re: getting users to logoff
- From: Mathieu CHATEAU
- getting users to logoff
- Prev by Date: Re: getting users to logoff
- Next by Date: Reset Password
- Previous by thread: Re: getting users to logoff
- Next by thread: Re: getting users to logoff
- Index(es):
Relevant Pages
|