can ruby script detect 'pc lock', 'pc unlock' instances ?

V

Vijay Ramane

Hello i need urgent help
How we can manage/detect instances like pc lock or pc unlock via ruby
script

e.g
1). If i start my pc then script will automatically start until i
log-off.
2). If i lock my pc script will start counting time until i unlock pc.
3). then it will shows whole days lock-unlock time

how will i manage this via only rubyscript ?????????
 
P

Phillip Gawlowski

Hello i need urgent help
How we can manage/detect instances like pc lock or pc unlock via ruby
script

Use Windows' Event Log instead (Account auditing has to be enabled via
group policy in Active Directory or locally on the machine for this to
work, otherwise you'd've to hook into explorer or svchost to gather
the locking messages).
e.g
1). If i start my pc then script will automatically start until i
log-off.
2). If i lock my pc script will start counting time until i unlock pc.
3). then it will shows whole days lock-unlock time

No need to, since Windows can keep track of Logon / Logoff events
(4624, 4634 are the respective Event IDs). Just interface with the
Security event log, and parse it (or export it as XML, *then* parse
it). Windows doesn't directly provide a Lock/Unlock message, but if
there was no shutdown of the system between the logoff and logon
events, it's rather certain that it was an (un)locking

Apparently, the win32-eventlog gem[0] can make parsing event logs easier.

Note: I haven't tested it, so I have no idea if it works with Ruby 1.9
or so, and the documentation doesn't say anything about this, either.

[0] http://rubyforge.org/docman/view.php/85/1738/EventLog.html
--
Phillip Gawlowski

Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.
 
V

Vijay Ra

Thank You very very much


Phillip Gawlowski wrote in post #971098:
Note: I haven't tested it, so I have no idea if it works with Ruby 1.9
or so, and the documentation doesn't say anything about this, either.

[0] http://rubyforge.org/docman/view.php/85/1738/EventLog.html
--
Phillip Gawlowski

Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top