I found one at http://www.cadtutor.net/forum/showthread.php?21079-Viewport-Lock-Routine.
Follow the instructions for adding (vl-load-com) near the beginning of the code.
I don't know how much you know about LISP routines, so here is a rundown. Ignore it if you already know it!
If you don't know AutoLISP the files are created in Notepad with the extension .lsp. Copy the code to a Notepad file and save it as myvpl.lsp; add (vl-load-com) before (princ "\nVPLOCKER.LSP c2002 KDCAD, inc. and save the file in your support directory. I have created a folder that has all my LISP, script and macro routines and have added it to my Tools/Options/Files/Support Files Search Path.
Use the command APPLOAD to load the LISP file. You can add it to the Startup Suite in the APPLOAD dialog box. There are 4 subroutines in the main file.
VPL locks a viewport
VPAL locks all viewports
VPU unlocks a viewport
VPAU unlocks all viewports
If you want to lock all the viewports type VPAL at the command line.
The code changes the color of viewports to cyan (color 4) or ByLayer (color 256). If you don't want it to do this just put 3 semicolons in front of the line like this: ;;; (vlax-put-property vlaobj 'Color 4) or delete the line of code.
If you have AutoDesk's ScriptPro or another script batch processor you can create a script to run the program on many files in a batch operation.
I know the basics of LISP programming so that is about all I can tell you. Good luck.
Nancy