Thursday, 20 February 2014

Windows 7: Change the logon screen (ctrl+alt+del) using BgInfo, Registry tweek and Script

BgInfo:







Script:

echo F | xcopy C:\Windows\System32\BgInfo\BGInfo.bmp C:\Windows\System32\oobe\info\backgrounds\backgroundDefault.jpg /F /D /Y 


Without echo F, script prompts for is the destination file or directory. echo 'f' - for file or 'd' for directory before the xcopy command using pipe symbol "|" on the same line

If anyone in the future wants to use this script to display IPv4 only addresses in BGInfo, here it is.
strMsg = ""
strComputer = "."

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set IPConfigSet = objWMIService.ExecQuery("Select IPAddress from Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'True'")

For Each IPConfig in IPConfigSet
 If Not IsNull(IPConfig.IPAddress) Then
 For i = LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
  If Not Instr(IPConfig.IPAddress(i), ":") > 0 Then
  strMsg = strMsg & IPConfig.IPAddress(i) & vbcrlf
  End If
 Next
 End If
Next

Echo strMsg

Enabling Custom Backgrounds

This feature is disabled by default, so you’ll have to enable it from the Registry Editor. You can also use the Group Policy Editor if you have a Professional version of Windows – scroll down a bit for the Group Policy Editor method.
Launch the Registry Editor by typing regedit into the search box in the Start menu and pressing Enter.
image
In the Registry Editor, navigate to the following key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background
image
You’ll see an DWORD value named OEMBackground. If you don’t see it, right-click in the right pane, point to the New submenu and create a new DWORD value with this name.
Double-click the OEMBackground value and set its value to 1.
image
Note that selecting a new theme in the Appearance and Personalization window will “unset” this registry value. Selecting a theme will change the value of the key to the value stored in the theme’s .ini file, which is probably 0 – if you change your theme, you’ll have to perform this registry tweak again.
gpedit.msc
If you have access to the Group Policy Editor, launch gpedit.msc from the Start menu.
image
Navigate to the following section in the Group Policy Editor window:
Computer Configuration\Administrative Templates\System\Logon
image
You’ll find a setting named “Always use custom login background.” Double-click it and set it to Enabled.

Setting An Image

Your image file must be less than 256 KB in size. It’s also a good idea to use an image file that matches the resolution of your monitor, so it won’t look stretched.
Windows looks for the custom logon screen background image in the following directory:
C:\Windows\System32\oobe\info\backgrounds
By default, the info and backgrounds folders don’t exist. Navigate to the C:\Windows\System32\oobe folder and create them yourself by right-clicking inside the folder, pointing to New, and selecting New Folder.
Copy your desired background image to the backgrounds folder and name it backgroundDefault.jpg.
The change will take effect immediately – no system reboot required. The first time you log out or lock your screen (try the WinKey-L keyboard shortcut), you’ll see your new background.
Convert BMP to JPG:
A small and free command line utility that converts a single .bmp file or a directory containing multiple .bmp files into jpg’s.
Requires .Net Framework 2.0 or later.
UPDATE! Sorry, the previous download File was corrupted. Please download this zip file now.
Download
  BMP2JPG.exe (8.0 KiB, 29,760 hits)
Help:
BMP2JPG :: Converts BMP to JPG (100% JPEG Quality only) :: Version 1.0

Converts BMP Files
Syntax :: BMP2JPG [Source Directory or File] [Destination Directory or File] [overwrite]
::
:: Examples
::
BMP2JPG "C:\Temp\My Bitmap.bmp" "C:\Temp\My JPEG File.jpg"
Converts a single File
BMP2JPG "C:\Temp\My BMP Folder" "C:\Temp\My JPEG Folder"
Converts all Files found in "C:\Temp\My BMP Folder" to "C:\Temp\My JPEG Folder"
BMP2JPG "C:\Temp\My BMP Folder" "C:\Temp\My JPEG Folder" overwrite
Converts all Files found in "C:\Temp\My BMP Folder" to "C:\Temp\My JPEG Folder"
Overwrites Existing Files

Author :: Tom Schindler, 2010 | http://www.microtom.net
Codename :: WIN32_ConvertBMP2JPG
Code:
using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.Drawing.Drawing2D; using System.IO;   namespace BMP2JPG { class Program {   public static bool overwriteall = false;   static void Main(string[] args) { CheckArguments(args);   string source = args[0], destination = args[1];   if (args.Length > 2) { if (args[2].ToLower() == "overwrite") overwriteall = true; }   if (Directory.Exists(source)) { Console.WriteLine("Directory Found: {0}", source); foreach (string bmpfile in Directory.GetFiles(source, @"*.bmp")) { ConvertFile(bmpfile, destination + @"\" + Path.GetFileNameWithoutExtension(source + @"\" + bmpfile).ToString() + ".jpg"); } if (!Directory.Exists(destination)) { try { Directory.CreateDirectory(destination); } catch { Console.WriteLine("Unable to create destination Directory {0}", destination); Environment.Exit(1); } }   /* foreach (string jpgfile in Directory.GetFiles(source, @"*.jpg")) { ResizeFile(jpgfile, destination + @"\" + Path.GetFileNameWithoutExtension(destination + @"\" + jpgfile).ToString() + "_Resize.jpg", 100, 100, 80); } */   } else { ConvertFile(source, destination); } }   public static void ConvertFile(string source, string destination) { string input = "n";   if (!File.Exists(source)) { Console.WriteLine("Input File not found! {0}", source); }   Console.WriteLine("Converting {0}", source);   if (File.Exists(destination) & !overwriteall) { Console.WriteLine("The Destination File already exists! Overwrite? [Y]es, [N]o, [A]ll"); input = Console.ReadLine().ToString().ToLower(); if (input == "a") overwriteall = true; else if (input != "y" & input != "n") { Console.WriteLine("Invalid input! Possible Answers: y, n or a!"); return; } }   if (input == "y" | overwriteall | !File.Exists(destination)) { try { using (Image img = Image.FromFile(source)) { img.Save(destination, ImageFormat.Jpeg); } Console.WriteLine("Successfully converted {0} to {1}", source, destination); } catch { Console.WriteLine("Failed to convert {0}", source); } } }   public static void ResizeFile(string source, string destination, int width, int height, long quality) { Bitmap b = new Bitmap(source); Image i = resizeImage(b, new Size(width, height)); saveJpeg(destination, (Bitmap)i, quality); }   private static Image resizeImage(Image imgToResize, Size size) { int sourceWidth = imgToResize.Width; int sourceHeight = imgToResize.Height;   float nPercent = 0; float nPercentW = 0; float nPercentH = 0;   nPercentW = ((float)size.Width / (float)sourceWidth); nPercentH = ((float)size.Height / (float)sourceHeight);   if (nPercentH < nPercentW) nPercent = nPercentH; else nPercent = nPercentW;   int destWidth = (int)(sourceWidth * nPercent); int destHeight = (int)(sourceHeight * nPercent);   Bitmap b = new Bitmap(destWidth, destHeight); Graphics g = Graphics.FromImage((Image)b); g.InterpolationMode = InterpolationMode.HighQualityBicubic;   g.DrawImage(imgToResize, 0, 0, destWidth, destHeight); g.Dispose();   return (Image)b; }   private static void saveJpeg(string path, Bitmap img, long encquality) {   EncoderParameter qualityParam = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, encquality);   ImageCodecInfo jpegCodec = GetEncoderInfo("image/jpeg");   if (jpegCodec == null) return;   EncoderParameters encoderParams = new EncoderParameters(1); encoderParams.Param[0] = qualityParam;   img.Save(path, jpegCodec, encoderParams); }   private static ImageCodecInfo GetEncoderInfo(String mimeType) { int j; ImageCodecInfo[] encoders; encoders = ImageCodecInfo.GetImageEncoders(); for (j = 0; j < encoders.Length; ++j) { if (encoders[j].MimeType == mimeType) return encoders[j]; } return null; }   public static void CheckArguments(string[] args) { if (args.Length < 2) { Console.WriteLine("-------------------------------------------------------------------------------"); Console.WriteLine(" BMP2JPG :: Converts BMP to JPG (100% JPEG Quality only) :: Version 1.0"); Console.WriteLine("-------------------------------------------------------------------------------"); Console.WriteLine("\n"); Console.WriteLine("Started : " + DateTime.Now); Console.WriteLine("\n"); Console.WriteLine("Converts BMP Files"); Console.WriteLine("\n"); Console.WriteLine(" Syntax :: BMP2JPG [Source Directory or File] [Destination Directory or File] [overwrite]"); Console.WriteLine("\n"); Console.WriteLine("::"); Console.WriteLine(":: Examples"); Console.WriteLine("::"); Console.WriteLine(" BMP2JPG \"C:\\Temp\\My Bitmap.bmp\" \"C:\\Temp\\My JPEG File.jpg\""); Console.WriteLine(" Converts a single File"); Console.WriteLine("\n"); Console.WriteLine(" BMP2JPG \"C:\\Temp\\My BMP Folder\" \"C:\\Temp\\My JPEG Folder\""); Console.WriteLine(" Converts all Files found in \"C:\\Temp\\My BMP Folder\" to \"C:\\Temp\\My JPEG Folder\""); Console.WriteLine("\n"); Console.WriteLine(" BMP2JPG \"C:\\Temp\\My BMP Folder\" \"C:\\Temp\\My JPEG Folder\" overwrite"); Console.WriteLine(" Converts all Files found in \"C:\\Temp\\My BMP Folder\" to \"C:\\Temp\\My JPEG Folder\""); Console.WriteLine(" Overwrites Existing Files"); Console.WriteLine("\n"); Console.WriteLine("\n"); Console.WriteLine(" Author :: Tom Schindler, 2010 | http://www.microtom.net"); Console.WriteLine(" Codename :: WIN32_ConvertBMP2JPG"); Environment.Exit(0); } } } }

No comments:

Post a Comment