Bluescreen is a screen saver that is part of the SysInternals suite that mimics a Windows blue screen of death. It can also mimic chkdsk and the boot process. Screen savers themsevles are actually just executable files renamed with an extension “scr”. Once placed in the System32 or SysWow64 directory, they can be accessed via the personalization control panel applet. In order to get this to work with PowerShell, it was necessary to create an executable that could be used to bootstrap the PowerShell script that would display the blue screen. This is accomplished by calling the C# compiler directly.
Once we have an exe, we can just rename to scr and copy over to the system directory. Next, we need to create the ScreenSaver.ps1 file to actually display the screen saver. It will also need to process the special arguments that a screen saver is passed. There are three arguments: configuration, preview and full screen. In this example I only implemented the full screen mode. You can find out more information here.
The Show-ScreenSaver function is responsible for drawing the form that will save our screen. We need to create a window that spans the entire screen and that has no border. Then we add some event handlers to let us exit the screen saver.
Next, we create all the text, format it and position it correctly on the form. Once this is complete, we can just display our form using ShowDialog.
Once the proper files are copied to the system directory. We can see that the screen saver shows up in the screen saver options window.
Clicking preview will start the bootstrapper process that will then launch the ScreenSaver.ps1 script and we get to see the pretty new Windows 8 blue screen! Clicking or pressing any key will close the screen saver.