Boot directory is the directory from which your computer boots up. It contains the operating system files that are used to start your computer. Powershell can be used to find the boot directory of a computer. Using a single Powershell cmdlet, you can find the boot directory of a computer.
Below, we look at three ways by which you can find the boot directory of a computer using Powershell.
Find boot directory using WMIC command
The bootable directory of a computer can be found using the wmic command. The WMIC command to get boot directory of a computer is:
This command brings up all the boot directory information as per the screenshot below.
Personally speaking, I find WMI Object a better way to find the boot directory on a computer. Alternatively, you can use the CIM Instance method to find the boot directory of a computer.
Find boot directory using WMI Object method in Powershell
WMI Object method can be used to find the boot directory on a computer. The exact command for finding the boot directory of a computer is shared below:
get-wmiobject win32_bootconfiguration | Select Name, BootDirectory, Description
The WMI Object method makes use of the Win32_bootconfiguration class to fetch all the details pertaining to the boot configuration of the computer. For our specific requirements, we are collecting the boot directory and the partition information for boot files on the computer.
The output of this command is represented below as a screenshot reference.
Find boot directory using CIM Instance in Powershell
The CIM Instance method also makes use of the Win32_bootconfiguration class to find boot directory information on a computer. In more ways than one, the CIM Instance method is similar to the WMI Object method.
The exact command to find the boot directory on a computer is shared below:
Get-CimInstance win32_bootconfiguration | Select Name, BootDirectory, Description
The output of this command is represented below in the screenshot.
You can see that the command output of the CIM Instance and WMI Object cmdlet for Win32_bootconfiguration are similar.
As part of the command output, we get the boot directory and partition information of the disk from which we are booting up. We see that the boot partition corresponds to the first partition on the first hard drive of this computer.
These commands can be used to find the boot directory of a local or remote computer. For remote computers, we do suggest using Powershell to create a remote connection. Once you are connected to the remote computer using the PSExec session, you can run any of these commands locally to fetch the boot directory on the specific system.
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?
Rajesh Dhawan is a technology professional who loves to blog about smart wearables, Cloud computing and Microsoft technologies. He loves to break complex problems into manageable chunks of meaningful information.