left corner
right corner
Me
 Post List Minimize

 Print   
 Search Posts Minimize

 Print   
 Blog_Archive Minimize

 Print   
..:: Blogs ::..
 Current Postings Minimize
Jul 1

Written by: Chuck Buchanan
7/1/2008 1:37 PM

In my last post I describe how I got to this particular point. The short of it is that I want to be able to switch operating systems with a single click. The solution that I scripted will probably take you two because of the "are you sure you want to do that?" mentality of Vista and Win2008. So we will create a script for each OS we have (two for me) which rewrites the BCD to boot to the other OS, set the reboot timeout to 0 so that it starts to boot without delay, then restarts the system. Save in a file with the .bat extension. Simple enough, just three lines of code, well six if you count each OS. So here it is:

bcdedit /default {hashcode}
bcdedit /timeout 0
shutdown /m \\YourMachineName /r /t 0

So line by line:

bcdedit /default {hashcode} <- this is the hash code for the OS you want to boot into. To find out what that is open up a command prompt (you will have to run the command prompt as administrator) and type BCDedit and enter. You should see something to the effect of:

Windows Boot Manager
--------------------
identifier              {bootmgr}
device                  partition=C:
description             Windows Boot Manager
locale                  en-US
inherit                 {globalsettings}
default                 {current}
displayorder            {e3e56426-43ea-11dd-8dda-a1f9647bf991}
                        {current}
toolsdisplayorder       {memdiag}
timeout                 0

Windows Boot Loader
-------------------
identifier              {e3e56426-43ea-11dd-8dda-a1f7647bf791}
device                  partition=E:
path                    \Windows\system32\winload.exe
description             Microsoft Windows Vista
locale                  en-US
inherit                 {bootloadersettings}
osdevice                partition=E:
systemroot              \Windows
resumeobject            {e3e56927-43ea-11dd-8dda-a1f3647bf991}
nx                      OptIn

Windows Boot Loader
-------------------
identifier              {current}
device                  partition=C:
path                    \Windows\system32\winload.exe
description             Microsoft Windows Server 2008
locale                  en-US
inherit                 {bootloadersettings}
osdevice                partition=C:
systemroot              \Windows
resumeobject            {222b9a31-18a7-11dd-a0e9-81cd4c29fb07}
nx                      OptOut

The identifier that says {current} is the OS that we a currently in, so we want the other. You will need the whole string and the brackets:   {e3e56426-43ea-11dd-8dda-a1f7647bf791}

bcdedit /timeout 0 <- This sets the timeout to 0. You will not be prompted for OS selection as it will just start booting the default OS... which is now the other OS.

shutdown /m \\YourMachineName /r /t 0 <- Replace YourMachineName with the actual name of your machine. This line will reboot your machine without warning or delay. So make sure you want to do that first. :)

So I created a script for each OS to boot into the other. This script MUST be run as administrator in order to execute anything with BCDedit. If you don't you will most likely just get a reboot into the same OS that is current as it did not update the /default setting. What I did was put both scripts on a folder on the shared data drive between the two OS-s and put the appropriate short cut in my quick launch menu setting the short cut to run as administrator. So all is good.

powered by metaPost

Tags:

Your name:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment    Cancel  

  

 
Copyright 2007 by Charles Buchanan, JR   Terms Of Use  Privacy Statement
This site is a personal development test of Charles Buchanan and not intended for commercial use. Some Material found on this site may have copyright and is being used under fair use. All other material is copyright of Charles Buchanan.
left bottom corner
 
right bottom corner