10
2
|
For example, if I'm booted from Windows PE, or remoting into a system using psexec or another command-line based method. I know that
diskpart.exe allows you to set the active partition, but I can't find any way of seeing which partition is currently active.
Hopefully there's a simple answer and I'm just missing it ...
| |||
add a comment
|
12
+100
|
Only way I know how to do this is close to what @Maximus put but do the following:
The output will indicate
You have to go through each volume to find which ones are Active and which ones are not. You can use Diskpart's
list volume command to show all volumes and find the one you want to check first. | |||
7
|
You can use
wmic to do this. You may wish to export it to a text file (>output.txt ) and view without word wrapping since the tabular output can get very wide.
To list all partitions (look at the
BootPartition member to check if it's marked as active ):
To list just active partitions, filter with
where :
To filter which columns are displayed, use
get :
Also:
For more information on
partition members, see the Win32_DiskPartition documentation.
Take a look at the WQL syntax for more information on the usage of
where . Take a look at wmic partition get /? for more information on get .
With
wmic you have added advantages with remote management using the /node:<servername or ip> switch (see wmic /node /? for more information. As per Microsoft:
If you can figure out some way of programmatically (e.g. batch script) getting the drive letter from the disk and partition index, you may wish to use a
for loop with the members DiskIndex and Index (disk and partition indexes, respectively). | |||
2
|
As a fans of Cygwin, I'll suggest use the fdisk utility from the util-linux package to do this if you're not using GPT.
If you're remoting into a system, you need to install Cygwin on that system.
If you're booting from Windows PE, you can manually download the packages and extract them using a proper decompressor which can handle .tar.bz2 files.
Packages needed to download to run fdisk
Example (1 hdd, 1 flash drive)
| ||
1
|
Look into last column (System)?
| ||
detail disk
(first column)? May be it is the answer? – Maximus Jul 16 '12 at 21:10