1) What do you want to automate? Lock? Well, you can use also the windows key+L (the L key). To unlock, you have to press ctrl+alt+del and enter the username and password (username, in case you want to log off the user which locked the computer). You can't automate this -- but you can disable the lock option (why do you want to do it?). Are you in a domain? Then talk to network administrator/system administrator. It's your home computer? Then use the simple logon options, without passwords.
A simple way to lock the computer it's to set the computer to lock when enters in screen saver mode.
2) For shutdown at a specified time: you may create a bat file, which should contain a line like:
shutdown -s -f -t 60
(see shutdown command in windows)
And then, add a new scheduled task which runs that bat file at the specified time.