Windows Setup, Boot Manager, And Multiple Disks

Although Windows Setup has evolved since the days of Windows 95, it sometimes is still a real pain in the ass.

Today, I spent the whole morning figuring out why Windows Setup always placed the Windows boot manager on a separate drive – and not on the drive I was installing Windows onto.

The “easiest” solution would be to unplug all other drives, install Windows, and then replug all drives. But since I’m a engineer I wanted to find out the real cause of the problem.

Turns out, the root problem is the BIOS’ boot order (a.k.a. boot sequence). A computer’s BIOS has a boot order list which basically defines from which device (hard disk, CD drive) to boot. If the BIOS can’t boot from the first device, it tries the second one, and so on.

The BIOS usually lets you define this order. Either all devices are in one big list, or each device type (CD drives, hard disks) has its own list.

Example of a boot order menu item in a BIOS

Now, when you install Windows, the setup asks the BIOS for this list. And no matter what you do, Windows Setup will always install the boot manager on the first hard disk in this boot order list.

In particular, the disk on which you want to install Windows has no influence on where the boot manager is being installed.

So, the only way to influence the location of the boot manager is to change to boot order in the BIOS.

Side note: New devices are usually added to the end of the boot order list. So if you have multiple hard drives and replace one (e.g. because the old one was broken or too small), the new drive may end up at the end of the list – and not at the position where the replaced drive was before; thus messing up the boot order.

Determining the Boot Manager Partition

So, how can one determine the location of where boot manager is installed?

From Windows Setup

Determining on which drive Windows Setup will install the boot manager onto is almost impossible from Windows Setup itself.

The only hint you get, is if:

  • your installation disk has no partitions (i.e. is empty) …
  • .. and then you can create a partition on this disk.

In this case Windows Setup will show you a dialog reading:

To ensure that all Windows features work correctly, Windows might create additional partitions for system files.

If this happens and you click on “OK”, Windows Setup will automatically create a partition called “System Reserved” where it’ll install the boot manager.

boot-manager-in-windows-setup.jpg

If this doesn’t happen the boot manager may or may not be installed in the correct location. If this is the case, you can only check the location after Windows has been installed.

From Windows

To determine the partition where the boot manager is installed, go to:

Control Panel > Administrative Tools > Computer Management > Disk Management

The partition where the boot manager is installed has the word System in its status.

sytem-partition.jpg

Windows Update Progress Bar Fail

If you have some progress you can use a progress bar to show this progress.

So, if you copy some files and have already copied about 60%, you may see something like this:

Progress bar showing copy progress of some files

Knowing this, what’s wrong with this image?

Indeterminate progress bar on download progress in Windows Update

Why the heck do I get an indeterminate progress bar for a download progress. Hell, there’s even a percentage displayed for the download.

File Download Script for Visual Studio

download-progress-dialog.png

If you have some binary files you need for your Visual Studio project but you don’t want to add them to your version control system, here’s a PowerShell script that does the downloading for you:

download.ps1

Basically this mimics a very simple dependency management.

Source Repository: https://bitbucket.org/mayastudios/powershell-downloader/

Configuration

At the very top of the script, you define which files to download where.

For example, this downloads the x86 and the x64 version of a SQLite .dll file:

$base_url = 'https://mydomain.com/sqlite'
$files = @{
  '..\sqlite.dll' = "$base_url/x86/sqlite.dll"
  '..\sqlite_x64.dll' = "$base_url/x64/sqlite_x64.dll"
}

Entries must be separated by line breaks or semicolon (;).

Paths are relative to the location of the script file.

Usage

To include the script in your project, call it from your project’s Pre-build event.

For example, if you’ve placed download.ps1 in a folder called libs in your project, use this line to execute it:

powershell -ExecutionPolicy ByPass -File "$(ProjectDir)\libs\download.ps1"

That’s it.

When Does It Download

The script will download the files if:

  • they don’t exist
  • the script file is newer as the files (idea behind this: you’ve changed the file version to download)
  • a file named force-download.txt exists in the scripts folder and this file contains anything else but “false”

These rules are defined in the Needs-Downloading function.

How To Fix Multiple Items In The ‘Open With’ Menu in OS X

Did you ever get that annoying problem that in your “Open With” menu the same app shows multiple times?

Multiple items for the same app showing in OS X's "Open With" menu.

Fortunately, this is easy to fix. Just open up Terminal and paste in the following lines (all at once) to fix the problem!

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user && pkill Finder

Cause of the problem: When you delete an application, its entry in the “Open With” menu is not deleted. This also applies to app updates, where the old version of the app is deleted and replaced by a new one (which gets its own menu entry). The problem probably only occurs for non-Mac App Store apps.

Sort posts by modification date in WordPress

By default, WordPress sorts blog posts by creation date. However, if you update your blog posts from time to time, you may want to sort them by modification date rather than creation date.

To achieve this, use this snippet:

function order_posts_by_mod_date($orderby) {
  if  (is_home() || is_archive() || is_feed()) {
    $orderby = "post_modified_gmt DESC";
  }

  return $orderby;
}

add_filter('posts_orderby', 'order_posts_by_mod_date', 999);

In your theme, just dump this snippet into functions.php. (You may need to create this file in your theme’s directory.)