Reputation: 59
I am trying to extract the VolumeGuid of EFI partition. I have been able to do it successfully on Windows 10 Machine using WMI query and Via code using C# ManagementObjectSearcher. I created a VHD with a GPT partition type within it I created the following, a recovery partition, EFI system partition and a basic data partition. The following is the WMI query I run in powershell after mounting the VHD. I am unable to extract the same in a Windows 2012 R2 machine. Rest of the partitions volume guid I am able to extract in Window 2012 R2 machine.
Sample DiskPart script
CREATE PARTITION PRIMARY SIZE=450 OFFSET=1024 ID=de94bba4-06d1-4d40-a16a-bfd50179d6ac
FORMAT FS=NTFS LABEL="Recovery" UNIT=4096 QUICK
CREATE PARTITION PRIMARY SIZE=99 OFFSET=461824 ID=c12a7328-f81f-11d2-ba4b-00a0c93ec93b
FORMAT FS=FAT32 LABEL="" UNIT=512 QUICK
CREATE PARTITION PRIMARY SIZE=129481 OFFSET=579584 ID=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
FORMAT FS=NTFS LABEL="" UNIT=4096 QUICK
WMI Query
"Get-WmiObject -Query "SELECT * FROM Msft_Volume" -Namespace Root/Microsoft/Windows/Storage"
In powershell on windows 10, I can see out for the EFI partition as shown below.
__GENUS : 2
__CLASS : MSFT_Volume
__SUPERCLASS : MSFT_StorageObject
__DYNASTY : MSFT_StorageObject
__RELPATH : MSFT_Volume.ObjectId="{1}\\\\computer\\root/Microsoft/Windows/Storage/Providers_v2\\WSP_Volume
.ObjectId=\"{efe10384-2fc4-11e9-bb16-806e6f6e6963}:VO:\\\\?\\Volume{f2f37b30-47b8-4553-804d-9b14
f6b32e1b}\\\""
__PROPERTY_COUNT : 18
__DERIVATION : {MSFT_StorageObject}
__SERVER : computer
__NAMESPACE : Root\Microsoft\Windows\Storage
__PATH : \\computer\Root\Microsoft\Windows\Storage:MSFT_Volume.ObjectId="{1}\\\\computer\\root/Micros
oft/Windows/Storage/Providers_v2\\WSP_Volume.ObjectId=\"{efe10384-2fc4-11e9-bb16-806e6f6e6963}:V
O:\\\\?\\Volume{f2f37b30-47b8-4553-804d-9b14f6b32e1b}\\\""
AllocationUnitSize : 512
DedupMode : 4
DriveLetter :
DriveType : 3
FileSystem : FAT32
FileSystemLabel :
FileSystemType : 6
HealthStatus : 0
ObjectId : {1}\\computer\root/Microsoft/Windows/Storage/Providers_v2\WSP_Volume.ObjectId="{efe10384-2fc4-
11e9-bb16-806e6f6e6963}:VO:\\?\Volume{f2f37b30-47b8-4553-804d-9b14f6b32e1b}\"
OperationalStatus : {2}
PassThroughClass :
PassThroughIds :
PassThroughNamespace :
PassThroughServer :
Path : \\?\Volume{f2f37b30-47b8-4553-804d-9b14f6b32e1b}\
Size : 99614720
SizeRemaining : 99613696
UniqueId : **\\?\Volume{f2f37b30-47b8-4553-804d-9b14f6b32e1b}\**
PSComputerName : computer
However the above WMI query does not return details for EFI partition when running on the "Windows 2012 R2". Even the same query run using c# code doesnt work.
Kindly suggest.
Upvotes: 2
Views: 1462