I recently posted an article about capturing screenshots of virtual machines. The PowerShell code is based on VMware’s PowerCLI and the VI Toolkit Extensions. The user interface was created with Sapien’s free PrimalForms. I received a lot of comments asking me if this script could be of any practical use in a production environment, and I must admit I had some thoughts about it too. This morning I received a real cool PowerShell script from Carter Shanklin, VMware’s Product Manager, End User Enablement. His script is able to run a screenshot through OCR and extract anything interesting from it.
Optical Character Recognition (OCR) extracts text and layout information from document images. With the help of Microsoft Office Document Imaging Library (MODI), which is contained in the Office 2003 and 2007 package, you can easily integrate OCR functionality into your own applications. In combination with the MODI Document Viewer control, you will have complete OCR support with only a few lines of code.
In the image you see the "Virtual Machine Blue Screen Detector" in action, first it captures a screenshot of a virtual machine. Secondly it uses the Toolkit Extensions to copy it to the local drive. When the PNG image is saved on the local drive, it’s converted to TIFF. The TIFF image will be used to extract the text using OCR.
Now, how can we create a blue screen? We could use this utility, “StartBlueScreen.exe” just as it sounds, allows you to crash the Windows operating system by initiating a Blue Screen of Death according to 5 parameters that you specify from command-line. StartBlueScreen.exe loads a very small device driver named NirSoftBlueScreenDriver.sys that calls the crash API function of Windows Kernel (KeBugCheckEx) with the 5 crash parameters that you specify in the command-line.
You can get your copy of the Virtual Machine Blue Screen Detector here.
Update : Luc Dekens (@LucD22) Great script, nice how it brings different features together. Now could you make it read out the BSOD ? ;-) Sure Luc, here you go.