I guess there is some kind of easy way to see if the computer is locked using WMI or something.
Locking it can be done with kix.

Quote from the 4.60 manual page 98/99.
 Code:
SETSYSTEMSTATE
Action
Changes the (power)state of the computer.

Syntax
SETSYSTEMSTATE (mode, force)

Parameters
Mode
Optional parameter specifying one of the following modes:
Value	Action
0	Lock system (supported on Windows 2000 or higher only).
1	Standby.
2	Hibernate.
3	Poweroff.
Force 
Specifies whether applications with unsaved changes are forcibly closed.
If force is not zero, applications are closed.
If force is zero, a dialog box is displayed prompting the user to close the applications. 
Returns

0	Action succeeded
System error code	Action failed


Example
$RC = SetSystemState( 1 , 1 )  ; Force system to StandBy mode


Edited by Mart (2007-10-04 09:52 AM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.