How can I remotely lock a Windows 7 computer from linux command line?
They are both on the same lan.
It would also be cool to know how to unlock it, but that isn't as important to me as of now.
Your solution must necessarily have two parts if you plan to do this over the network (which is the case since you mentioned "LAN"):
You might start with the reasonably secure notion of running a Secure Shell (SSH) server on Windows. See this ServerFault question for details.
Once you have your SSH server of choice configured on Windows, now you need to be able to remotely login to that SSH server using a client on Linux, which happens to be well-supported on Linux using OpenSSH's
Now, you're in a situation where you have a "remote terminal" to the Windows PC from the Linux box. Your next question is: how do I lock the screen from the command line? You've got the "transport" set up properly; now you just need to issue the command.
Well, SuperUser already has a question about that.
For your info (to help you be more self-sufficient in the future)
Since your question is a "two-part" question, I won't flag this as a duplicate of that question. But really, if you had analyzed your original question and broken it down into two parts like I did, you'd be able to easily google and find the answers to the separate questions and you'd be off to the races. Learn from this for next time: analyze your problem and divide it into digestible, solvable parts, rather than looking at it head-on as a "unit-problem". Every unit-problem is composed of sub-problems that are simpler, more comprehensible, and importantly, much more likely to already have been solved by other people.
Depending on your configuration and needs, you may be able to just use rdesktop to connect via Remote Desktop (passing the