Hi Everyone ,

I am trying to make a script which will trigger after a stipulated time say 20 minutes of no system activity (no user input or application running ).Can anyone guide me how to make such a script using vbs or batch.Thanks in advance.

Regards
Blacklisted Packager
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
I think you'd be extremely lucky to get ANY Windows system completely idle for 20 minutes - it's always up to SOMETHING! :)

Start here http://msdn.microsoft.com/en-us/magazine/cc302338.aspx, maybe...

Also, http://www.computerperformance.co.uk has some good WMI scripting examples.
Answered 09/04/2008 by: VBScab
Red Belt

Please log in to comment
0
ummmmmmm...i guess i was not able to frame my query properly...
Lets say i leave my system unattended for 20 minutes ,a screensaver pops up and locks my desktop. I want to make a script which will trigger in a similar manner and instead of running a screensaver i want to do some action.
Answered 09/04/2008 by: blacklisted_packager
Orange Belt

Please log in to comment
0
...then have your script test in a loop for any process whose extension is .SCR. As soon as one starts, you know you can kick off your action.
Answered 09/04/2008 by: VBScab
Red Belt

Please log in to comment
0
GMTA (great mind thinks alike ) .. before reading this post.. i made the script ..for checking the screensaver process but was not sure if its a best way ..
Answered 09/04/2008 by: blacklisted_packager
Orange Belt

Please log in to comment
0
I'd try not to tie it to a particular s/s, though. Keep it generic, to anything with a SCR extension.
Answered 09/04/2008 by: VBScab
Red Belt

Please log in to comment
0
Just take a look at my script..


Dim objWMIService, objProcess, colProcess,pos,WshShell,command
Dim strComputer, strList,i
i=0
call getproc
sub getproc
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process")
For Each objProcess in colProcess
pos=InStr(objprocess.name,".scr")
if (pos>0 AND i=0) then
Wscript.sleep(300000)
i=i+1
call getproc
end if
if (pos>0 AND i=1) then
call rebootAction
end if
Next
Set colprocess=nothing
Set objwmiservice=nothing
Wscript.sleep(10000)
call getproc
End Sub
sub RebootAction
set Wshshell= CreateObject("WScript.Shell")
command="shutdown.exe -s -t 30 -f"
Wshshell.run command,6,0
Set wshshell=nothing
Wscript.quit
end Sub
Answered 09/04/2008 by: blacklisted_packager
Orange Belt

Please log in to comment
0
.scr would also give you a false positive for the Windows logon process, among other things.

Are you looking for idle time for the system, or for a particular user? Think Terminal Server environment - 5 users logeed on, only one is currently active...
Answered 09/09/2008 by: revizor
Third Degree Blue Belt

Please log in to comment
Answer this question or Comment on this question for clarity