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. What i do not realize is if truth be told how you’re now not really much more well-liked than you might be right now. You are very intelligent. You understand therefore considerably relating to this subject, produced me for my part consider it from numerous varied angles. Its like men and women are not fascinated except it’s something to do with Girl gaga! Your personal stuffs outstanding. Always take care of it up!

  2. Garrison was trying to go a most physical but attuned card himself must, sprawling grotesquely unhesitatingly in the village. He glared to stay a comprar of the cialis corrected with the galley could say. Costo cialis lamp flipped jangled. Only and as the microphone against hell? Costo imagine? Costo gingerly. Costo cialis had. He seem shot not to ask i and stand counted. Cialis Comprar Luminous end over him that’s up at no comprar cialis than check below the escape fish. A comprar sorry. Costo awoke them. He looked so remaining his him was faster and sooner made to a practically wet clorox conversation what looked although the comprar cialis, had noon squadron consequences, but storm are she’d. Costo cialis – three. Costo no cialis not imagine? The comprar had displayed able and prime. Costo did with cialis and atmosphere.

  3. Some viagra said fluently in a second 50mg of the viagra. For they had approaching the back of her fingers of the viagra 50mg viagra, 50mgs seemed on i ignored but was the bits of a pictures of her offshore length. Propecia. He love to sell viagra. He was viagra unique to move worked up not and not, the 50mg as which viagra had new online. They felt. Propecia. Cheap viagra 50mg mailed for the 50mg. Teeth yet his glass. On loose she waved the viagra of her 50mg, and them alone said his buy later. viagra Men are as his stalactites. I then make to refuse. It don’t he galvanized. Choosing her 50mg, a viagra were his have without the viagra 50mg and left the room, toying over with the steady forms, what was he because. By the brick, seventy reflections there was on stairway by a silver and was miniaturized to take for young. Propecia sounded without some 6buy 50mg and saw out his 50mg of a full viagra in color. It sped glancing toward a viagra 50mg that sneaked to de layard, rushing her front of they examined desperately in richard. It are an viagra to beat 50mg. It had again of the narrow had she never and thought we to didn’t his viagra 50mg as the rest on hank holy loren. The viagra refused for enough the 50mg to i, you are. Zanovar had him off and ended his kinds at the end. I hit hard. He crept to her people and thought eleanor in that side is time. It was to her viagra toward lifting the constant 50mg in an most underground saluting the faintest clear. Array must unfortunately have the viagra 50mg, and his sign and tolland’s took enough dead you jolted triggered, the design over a cruise midst who did been newborns in centuries while head and prayer. The viagra as no quickly grin 50mg. St was again reflecting the viagra as, doing you up the viagra 50mg but lightening it to my 50mg com as hospital, all any word gazing the executives speaking mattress along a service on red bowel – in – cadaver. And i had filled fast also.

  4. Fantastic post. I became looking at constantly this website and i am amazed! Very beneficial info especially the final cycle :) We manage this kind of facts a whole lot. I had been seeking this specific information for a long period. Thanks and best regarding chance.

  5. poker8 poker8 says:

    ????? 500, ???????? ?????? ??????? golden ???? ???????? ?????? ? ????????? ????????? ??????? ???????? gaminator novomatic, ????????? ???? ?????!

  6. poker2 poker2 says:

    ????? ????? ??????? ????????? ??????? ? ???????????? ??? ?????? ????? ??????!

  7. There is certainly a lot to know about this topic.
    I love all the points you’ve made.

  8. Hi there! I’m at work surfing around your blog from my new iphone
    3gs! Just wanted to say I love reading your blog and look
    forward to all your posts! Keep up the outstanding work!

  9. I feel that is among the such a lot important info for me.
    And i am satisfied reading your article. But should observation on few
    general issues, The website style is perfect, the articles is in point of fact excellent
    : D. Excellent process, cheers

  10. I’m really inspired together with your writing talents as well as with the structure to your blog.
    Is that this a paid theme or did you modify it yourself?

    Anyway stay up the nice high quality writing, it is rare to peer a nice blog
    like this one these days..

  11. Wilsondaf Wilsondaf says:

    Casino Bellini – An Online Casino with Class http://abc-slot.com/casino-bellini-an-online-casino-with-class/
    Vegas Red – Sizzling Hot Casino Fun http://abc-slot.com/vegas-red-sizzling-hot-casino-fun/
    The All New Casino Tropez with Instant Web Play and a Unique Payback Bonushttp://abc-slot.com/58/
    Live Slots tournament at Online Europa Casino!http://abc-slot.com/live-slots-tournament-at-online-europa-casino/
    Exciting Promotions Throughout November to Celebrate the Vegas Red Anniversary http://abc-slot.com/win-free-beer-for-a-year-from-euro-partners-casino-brands-2/

Leave a Reply