Читать книгу Windows Server 2022 & Powershell All-in-One For Dummies - Sara Perrott - Страница 103

Configuring Startup Options with BCDEdit

Оглавление

With Windows Server 2008, Microsoft introduced a utility called BCDEdit, which allows you to manipulate the Windows boot configuration data (BCD) store. The BCD is used to tell the operating system how it should boot; it contains all the boot configuration parameters needed to support that function. This replaced the older bootcfg.exe utility that was used to edit the boot.ini file pre–Windows Vista. You must be a member of the local Administrator's group on a system to use BCDEdit. This is an advanced utility that is useful in troubleshooting issues that are preventing a server from booting properly.

You may need to disable or suspend both BitLocker and Secure Boot on a system before you can use BCDEdit.

Mistakes made using the BCDEdit utility could leave your system unable to boot at all. Always make sure that you either have a good backup of the system, or if you don’t have a good backup, export the current settings from BCDEdit so that you can restore them if needed. You can export the current boot configuration database by typing BCDEdit /Export <export_path>. If you need to restore from that export, the command is very similar. You need only type BCDEdit /Import <path_to_export>.

Table 4-2 lists some of the more common options available for BCDEdit.

TABLE 4-2 BCDEdit Common Options

Option Description
/bootdebug Enables or disables boot debugging.
/dbgsettings Configures the type of debugging connection.
/debug Enables or disables kernel debugging.
/delete Deletes boot entries from the datastore — use with caution!
/deletevalue Deletes or removes a boot entry option — use with caution!
/displayorder Sets the order used by the boot manager when displaying the multiboot menu.
/enum Lists all the entries in the boot configuration datastore.
/export Exports the contents of the BCD; can be used as a backup to restore the BCD.
/import Imports the contents of an exported file; can be used as a restore option if needed.
/set Sets a value in a boot option.

Most often, you'll use bcdedit /set to make changes to your boot configuration datastore. Before you make any changes, you need to know what your BCD looks like currently. You can use the /enum option to do that. In Figure 4-13, you can see the current settings for the Windows Boot Manager and the Windows Boot Loader.

You may notice that the description in the Windows Boot Loader just says Windows Server. Maybe you want it to be more descriptive than that. You can change it with bcdedit /set. You need the ID of the object that you're wanting to work on. In this case, you’re wanting to edit the Windows Boot Loader; the identifier that you can see in Figure 4-13 is {current}. The full command you type will look something like this:

bcdedit /set {current} description "Windows Server 2022 Standard"

This command will work perfectly in a command prompt, but if you try to run it in PowerShell, you’ll need to put quotes around the identifier. For instance, if I were to run the command in PowerShell I would type it like this:

bcdedit /set "{current}" description "Windows Server 2022 Standard"

When you get the message The operation completed successfully, use bcdedit /enum again. You'll see your new description. See Figure 4-14 for my example.


FIGURE 4-13: Using bcdedit /enum to see the current settings of the boot configuration datastore.


FIGURE 4-14: Using bcdedit /set to alter the description of the Windows Boot Loader entry.

Why would you want to change the name on the Windows Boot Loader? Consider the example of a multiple boot system that has the same operating system on both disks. The disks are used for very different purposes, so you want to ensure that you remember which is which. Being able to change the descriptions will simplify choosing the appropriate disk in the boot menu. BCDEdit can also be used to change the order of the boot menu. This is useful if you want to set one of your disks to be first in the list and the default disk to boot to after a certain amount of time.

Windows Server 2022 & Powershell All-in-One For Dummies

Подняться наверх