Remotely reboot a server into DSRM

I thought I’d start off the blog with something that I learned recently that I will probably never use. However, it’s quite useful to know anyway and it highlights a couple of cool features that you may not have known about.

The scenario is that you have a remote domain controller that you need to take offline and reboot into Directory Services Restore Mode. There are a couple of ways to do this but I am going to look at the most interesting…

The first thing we need to do is access the remote server’s boot.ini file and add a new entry to boot into DSRM. The first way to do this would be to connect to the server through remote desktop or terminal services and edit the file in notepad, but that’s far too easy so we won’t worry about that. What we’ll use is a tool called bootcfg which is included in Windows XP or 2003. This little utility allows you to query and edit the boot.ini file on either the local machine or a remote machine. The syntax is:

C:\>bootcfg /?

BOOTCFG /parameter [arguments]

Description:
This command line tool can be used to configure, query, change or
delete the boot entry settings in the BOOT.INI file.

Parameter List:
/Copy Makes a copy of an existing boot entry [operating
systems] section for which you can add OS options to.

/Delete Deletes an existing boot entry in the [operating
systems] section of the BOOT.INI file. You must specify
the entry# to delete.

/Query Displays the current boot entries and their settings.

/Raw Allows the user to specify any switch options to be
added for a specified boot entry.

/Timeout Allows the user to change the Timeout value.

/Default Allows the user to change the Default boot entry.

/EMS Allows the user to configure the /redirect switch
for headless support for a boot entry.

/Debug Allows the user to specify the port and baudrate for
remote debugging for a specified boot entry.

/Addsw Allows the user to add predefined switches for
a specific boot entry.

/Rmsw Allows the user to remove predefined switches for a
specific boot entry.

/Dbg1394 Allows the user to configure 1394 port debugging
for a specified boot entry.

/? Displays this help/usage.

Examples:
BOOTCFG /Copy /?
BOOTCFG /Delete /?
BOOTCFG /Query /?
BOOTCFG /Raw /?
BOOTCFG /Timeout /?
BOOTCFG /EMS /?
BOOTCFG /Debug /?
BOOTCFG /Addsw /?
BOOTCFG /Rmsw /?
BOOTCFG /Dbg1394 /?
BOOTCFG /Default /?
BOOTCFG /?

The first option we’ll use is the query:

C:\>bootcfg /s dc-server /query

Boot Loader Settings
——————–
timeout:30
default:multi(0)disk(0)rdisk(0)partition(1)\WINDOWS

Boot Entries
————
Boot entry ID: 1
OS Friendly Name: Windows Server 2003, Standard
Path: multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
OS Load Options: /fastdetect /NoExecute=OptOut

The results above are typical of a new Windows Server 2003 build with no special options.

The next thing we need to do is create a copy of the fist entry so that we can add the correct options to it. We do this by using the copy switch and reference id 1 which is the fist entry as follows:

C:\>bootcfg /s dc-server /copy /id 1 /d “Directory Services Restore Mode”
SUCCESS: Made a copy of the boot entry “1”.

Now when we run the query again, we can see that there are now two boot entries in the boot.ini file:

C:\>bootcfg /s dc-server /query

Boot Loader Settings
——————–
timeout:30
default:multi(0)disk(0)rdisk(0)partition(1)\WINDOWS

Boot Entries
————
Boot entry ID: 1
OS Friendly Name: Windows Server 2003, Standard
Path: multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
OS Load Options: /fastdetect /NoExecute=OptOut

Boot entry ID: 2
OS Friendly Name: Directory Services Restore Mode
Path: multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
OS Load Options: /fastdetect /NoExecute=OptOut

The boot.ini file now looks like this:

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS=”Windows Server 2003, Standard” /fastdetect /NoExecute=OptOut
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS=”Directory Services Restore Mode” /fastdetect /NoExecute=OptOut

Now that we have the second boot entry we can add the option to boot into DSRM by using the “/SAFEBOOT:DSREPAIR” option by using the raw switch:

C:\>bootcfg /s dc-server /raw “/SAFEBOOT:DSREPAIR” /a /id 2
SUCCESS: Added the switch to OS entry for line “2” in the BOOT.INI file.

The query now shows this:

C:\>bootcfg /s dc-server /query

Boot Loader Settings
——————–
timeout:30
default:multi(0)disk(0)rdisk(0)partition(1)\WINDOWS

Boot Entries
————
Boot entry ID: 1
OS Friendly Name: Windows Server 2003, Standard
Path: multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
OS Load Options: /fastdetect /NoExecute=OptOut

Boot entry ID: 2
OS Friendly Name: Directory Services Restore Mode
Path: multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
OS Load Options: /fastdetect /NoExecute=OptOut /safeboot:dsrepair

The only thing left to do now is to adjust the timeout period, otherwise you’ll end up with a 30 second delay each time the server reboots. You can set this to what you want, but I’ll set it to 5 seconds here:

C:\>bootcfg /s dc-server /timeout 5
SUCCESS: Changed the timeout value in the BOOT.INI.

Now we have the boot.ini file completely prepared for the next step. Here’s what the query looks like:

C:\>bootcfg /s dc-server /query

Boot Loader Settings
——————–
timeout:5
default:multi(0)disk(0)rdisk(0)partition(1)\WINDOWS

Boot Entries
————
Boot entry ID: 1
OS Friendly Name: Windows Server 2003, Standard
Path: multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
OS Load Options: /fastdetect /NoExecute=OptOut

Boot entry ID: 2
OS Friendly Name: Directory Services Restore Mode
Path: multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
OS Load Options: /fastdetect /NoExecute=OptOut

And the boot.ini file looks like this:

[boot loader]
timeout=5
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS=”Windows Server 2003, Standard” /fastdetect /NoExecute=OptOut
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS=”Directory Services Restore Mode” /fastdetect /NoExecute=OptOut

So back to our scenario… the remote server needs to be rebooted into DSRM. Although we know that the boot.ini file has been edited correctly, we’ll still run the query (bootcfg /s main-vm-server /query) and we’ll make a note that the option we want is boot entry id 2. What we want to do is change the order of the boot sequence so that ID 2 is now ID 1 and the server will boot into DSRM. This is done like this:

C:\>bootcfg /s dc-server /default /id 2
SUCCESS: Changed the default OS entry in the BOOT.INI.

And the query shows that the two boot entrues have swapped positions:

C:\>bootcfg /s dc-server /query

Boot Loader Settings
——————–
timeout:5
default:multi(0)disk(0)rdisk(0)partition(1)\WINDOWS

Boot Entries
————
Boot entry ID: 1
OS Friendly Name: Directory Services Restore Mode
Path: multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
OS Load Options: /fastdetect /NoExecute=OptOut

Boot entry ID: 2
OS Friendly Name: Windows Server 2003, Standard
Path: multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
OS Load Options: /fastdetect /NoExecute=OptOut

Now all we have to is reboot the server using the shutdown.exe command:

shutdown /m \\dc-server /r /t 10 /f

Note that I’m using the /r to reboot the server, the /t to give myself 10 seconds to change my mind (if I do change my mind about rebooting the server I can use the /a switch to abort the reboot), and the /f to force any applications to close that aren’t behaving properly. When the server reboots, it will wait 5 seconds and then continue booting into DSRM. You can now connect to the server through remote desktop and continue restoring Active Directory as needed (more about that in a later article…)

Obviously, you need to remember to change the boot order back to how it was when you’re done otherwise you’ll be scratching your head wondering why the server isn’t booting properly! On the local machine you can use bootcfg without the /s switch and it will work locally by default. You just need to use the /query option to check the boot order, then the /default option to swap the order.

Hope this helps and (as always) comments – good/bad/ugly – are welcomed!

[Tags]Active Directory,Microsoft,bootcfg[/tags]

64 Responses to “Remotely reboot a server into DSRM”

  1. zabi zabi says:

    send ples book address
    iran-city zanjan-no;15-17shrevar street -lane;nobahar-lane 8m3-
    009802415236640

  2. […] It highlights the use of the BOOTCFG tool to remotely edit the boot.ini file on a windows server.http://activedir.blogtown.co.nz/2006/01/12/remotely-reboot-a-server-into-dsrm/How to Use and Edit Boot.ini in Windows XPBoot.ini is one of the very first files that come into […]

  3. software help
    Network to provide you with the best service

  4. A friend is never known till a man has need

  5. lorens9 lorens9 says:

    Hi all!
    will relax muscle spasms. I have used both separately and they did work very well. Take them if you need them this is why they were prescribed to you. Just take the dosage that is stated on the bottle. Take your meds and get better purchase on line
    Bye !!
    ____________________________
    levitra buy levitra online :)

  6. very well information you write it very clean. I’m very lucky to get this info from you.

  7. Johnyp Johnyp says:

    It is useful to try everything in practice anyway and I like that here it’s always possible to find something new. :)

  8. bouchard7 bouchard7 says:

    Hey!!!
    If there is too much cholesterol in your body, it sticks to the walls of the arteries. When cholesterol builds up, it creates a smaller opening for blood to pass through. purchase uk
    Goodluck!!!
    ____________________________
    can i buy online :)

  9. heidi2 heidi2 says:

    Hello
    ive been prescribed valproic acid its also called depekote for bipolar i was just wandering if its helped anybody and were there any negative side affects and how it made you feel buy canada
    Goodluck!!!
    ____________________________
    usa :)

  10. nelson abbot nelson abbot says:

    I even now use a printed directory to locate what I want. I find it in fact quicker than looking using the web.

  11. reynold4 reynold4 says:

    Good day
    with your doctor to ensure LEVITRA is right for you and that you are healthy enough for sexual activity. LEVITRA is not recommended for men with uncontrolled high blood pressure. online order
    Bye !!
    ____________________________
    online buy :)

  12. zehir-ch7 zehir-ch7 says:

    Good afternoon
    It’s natural and normal to want a healthy sex life, so if you think your high cholesterol may be affecting the quality of your erections, talk to your doctor about LEVITRA, a medication designed to help treat mild to severe ED. uk
    Goodluck!!!
    ____________________________
    uk buy :)

  13. ira6 ira6 says:

    Hi
    Take a dose of levitra 25 to 60 minutes before you wish to have sex with your partner. uk mail order
    Pa!!!
    ____________________________
    buy levitra alternative lavitra :)

  14. PotteAvetty PotteAvetty says:

    The clothes may wholesale baby clothing simply be tied up, as is the receptacle of the outset two garments; or pins or belts hold the garments in rooms, as in the victim of the latter two. The irreplaceable the religious ministry remains uncut, and people of various sizes or the that having been said being at dissimilar sizes can wear the garment.
    Another approach involves bitter and sewing the wholesale baby clothing material, but using every bit of the textile rectangle in constructing the clothing. The tailor may plate triangular pieces from inseparable corner of the textile, and then sum them elsewhere as gussets. Stock European patterns representing men’s shirts and women’s chemises acquire this approach.
    Current European fashion treats wholesale baby clothing cloth much less conservatively, typically sneering in such a wholesale baby clothing manner as to leave various odd-shaped cloth remnants. Industrial sewing operations traffic in these as waste; cuttingly sewers may course them into quilts.

  15. llc llc says:

    My cousin recommended this blog and she was totally right keep up the fantastic work!

  16. bisson0 bisson0 says:

    Good morning
    I have an upcoming drug test and took a Robaxin and need to know how long it stays in your urine generico impotencia
    Goodluck!!!
    ____________________________
    price shopper :)

  17. channan0 channan0 says:

    Greetings
    Swallow the tablet whole with a glass of water it can be taken with or without food also. buying online australia
    Goodluck!!!
    ____________________________
    order generic :)

  18. baldridg7 baldridg7 says:

    Hi there
    Difficulty getting and keeping an erection that lasts long enough to have successful sex is known as ED. generic from india
    Goodluck!!!
    ____________________________
    uk without prescription :)

  19. watch movie watch movie says:

    Willingly I accept. An interesting theme, I will take part. Together we can come to a right answer.

  20. Tagged home Tagged home says:

    I just cant stop reading this. Its so cool, so full of information that I just didnt know. Im glad to see that people are actually writing about this issue in such a smart way, showing us all different sides to it. Youre a great blogger. Please keep it up. I cant wait to read whats next.

  21. Worker Worker says:

    Greatings, activedir.blogtown.co.nz – da mejor. Guardar va!
    Gracias

    Worker

  22. DVD BLOG DVD BLOG says:

    I think, that you commit an error.

  23. arepedine arepedine says:

    Happy New Yearhttp://nfksghjskf.com/ – , everyone! :)

  24. I apologise, but, in my opinion, you are not right. Write to me in PM, we will talk.

  25. At you inquisitive mind

  26. Psypodyrogs Psypodyrogs says:

    Account oecumenical direction to consolidation in apposite the aggregate, interaction
    included, there is a gargantuan wend for as a improve take over as a remedy for studying English fashion in those parts of the court, where English is not a most prominent language. This conclusion leads us that there is gargantuan impecuniousness into the treatment of English-speaking tutors, who are specializing in teaching English. South Korea is twin of most categorical countries in terms of gonorrhoeic disquiet resolute, which means teaching English in Korea would be influentially profitable.

    click here

  27. Samsung Soul Samsung Soul says:

    Thank you for developing this website. The stories here are worth reading many times over in order to refresh us time and time again to do good and positive things and inspire or influence others to do the same.

  28. It absolutely agree with the previous message

  29. Bravo, is simply magnificent idea

  30. Psypodyrogs Psypodyrogs says:

    All in all wide-ranging gears to consolidation in outcome noteworthy deal out, patter
    included, there is a gargantuan inadequacy championing studying English communication in those parts of the humankind, where English is not a positive language. This conclusion leads us that there is brobdingnagian affidavit into the treatment of English-speaking tutors, who are specializing in teaching English. South Korea is a unambiguous of most optimistic countries in terms of medic harmonize forward, which means teaching English in Korea would be influentially profitable.

    click here

  31. Hey,

    Great!!! It is very useful information.But can you please tell me more brief on my mail.I got the script but having some doubts in mind.

    Thanks

  32. Tamil Serials online,Telugu Serials online,Hindi Serials online,Malayalam Serials online…

    […]Remotely reboot a server into DSRM « Active Directory Blog[…]…

  33. Watch Movies Shows Online…

    […]Remotely reboot a server into DSRM « Active Directory Blog[…]…

  34. Embroidery-Gulf / T-Shits / LOGO / Embroider / Neckline…

    […]Remotely reboot a server into DSRM « Active Directory Blog[…]…

  35. wholesale bags…

    […]Remotely reboot a server into DSRM « Active Directory Blog[…]…

  36. mbt outlet mbt outlet says:

    I do trust all the ideas you have introduced to your post. They are really convincing and can certainly work. Still, the posts are too quick for starters. May you please extend them a little from subsequent time? Thank you for the post.

  37. Excellent site. Plenty of helpful info here. I am sending it to several friends ans also sharing in delicious. And naturally, thanks on your effort!

  38. cash stores cash stores says:

    Robbing Paul to be able to pay http://www.dumblittleman.com/ Peter, or alternatively but unfortunately the actual suggesting goes.

  39. Depending on the actual business with whom a person do company, the entire income might be deposited straight in the banking account, or alternatively sent by cable through Western Union.

  40. I like the valuable info you provide to your articles. I will bookmark your blog and check once more right here regularly. I am fairly sure I will be informed many new stuff proper here! Best of luck for the next!

  41. malaysia sexy lingerie…

    […]Remotely reboot a server into DSRM « Active Directory Blog[…]…

  42. Scotty Scotty says:

    Avoir une excellente concentration est obligatoire selon les emplois http://gagnerconcentration.overblog.com/gagner-de-la-concentration

  43. Scottys Scottys says:

    Avoir une excellente organisation est obligatoire selon les Il est toujours benefique de gagner en organisation quelque sois votre emplois http://comprendreok.overblog.com/maitriser-rentabiliser-votre-temps

    Excellente journee a tous

  44. Emilio Emilio says:

    Avoir un excellent enrichissement personnel est benefique selon les Il est toujours benefique de gagner en enrichissement personnel et ce quelque sois votre secteur d’activite http://enrichissement-personnel.overblog.com/l-enrichissement-personnel
    Excellente journee a tous

Leave a Reply