you dont need r0 to get all these information
simply start wmic in cmd.exe
and get all the information you need
Code:
wmic:root\cli>path Win32_DiskPartition get Deviceid
DeviceID
Disk #0, Partition #0
Disk #0, Partition #1
Disk #0, Partition #2
Disk #2, Partition #0
wmic:root\cli>path Win32_logicaldisk get Deviceid
DeviceID
A:
C:
D:
E:
G:
wmic:root\cli>path Win32_diskdrive get Deviceid
DeviceID
\\.\PHYSICALDRIVE0
\\.\PHYSICALDRIVE2
wmic:root\cli>
try this command for an amazing amount of information about your diskdrives inside wmic
Code:
path Win32_DiskPartition assoc
or you can code a few lines in the latest leet language c#
or script oldstyle
Code:
ComputerName = "."
Set wmiServices = GetObject ( _
"winmgmts:{impersonationLevel=Impersonate}!//" _
& ComputerName)
' Get physical disk drive
Set wmiDiskDrives = wmiServices.ExecQuery ( _
"SELECT Caption, DeviceID FROM Win32_DiskDrive")
For Each wmiDiskDrive In wmiDiskDrives
WScript.Echo "Disk drive Caption: " _
& wmiDiskDrive.Caption _
& VbNewLine & "DeviceID: " _
& " (" & wmiDiskDrive.DeviceID & ")"
'Use the disk drive device id to
' find associated partition
query = "ASSOCIATORS OF {Win32_DiskDrive.DeviceID='" _
& wmiDiskDrive.DeviceID & "'} WHERE AssocClass = Win32_DiskDriveToDiskPartition"
Set wmiDiskPartitions = wmiServices.ExecQuery(query)
For Each wmiDiskPartition In wmiDiskPartitions
'Use partition device id to find logical disk
Set wmiLogicalDisks = wmiServices.ExecQuery _
("ASSOCIATORS OF {Win32_DiskPartition.DeviceID='" _
& wmiDiskPartition.DeviceID & "'} WHERE AssocClass = Win32_LogicalDiskToPartition")
For Each wmiLogicalDisk In wmiLogicalDisks
WScript.Echo "Drive letter associated" _
& " with disk drive = " _
& wmiDiskDrive.Caption _
& wmiDiskDrive.DeviceID _
& VbNewLine & " Partition = " _
& wmiDiskPartition.DeviceID _
& VbNewLine & " is " _
& wmiLogicalDisk.DeviceID
Next
Next
Next
output as follows for above script
wmic:/>cscript foo.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
Disk drive Caption: ************
DeviceID: (\\.\PHYSICALDRIVE0)
Drive letter associated with disk drive = ***********\\.\PHYSICALDRIVE0
Partition = Disk #0, Partition #0
is C:
Drive letter associated with disk drive = **********\\.\PHYSICALDRIVE0
Partition = Disk #0, Partition #1
is E:
Drive letter associated with disk drive = **********\\.\PHYSICALDRIVE0
Partition = Disk #0, Partition #2
is D:
Disk drive Caption: *********** USB Device
DeviceID: (\\.\PHYSICALDRIVE2)
Drive letter associated with disk drive = *********** USB Device\\.\PHYSI
CALDRIVE2
Partition = Disk #2, Partition #0
is G:
wmic:/>
above script is from ms
http://msdn2.microsoft.com/en-us/library/aa394592.aspx
Quote:
...detect which drive letter is associated with a logical disk partition? Start with the Win32_DiskDrive class and query for instances of Win32_DiskPartition using the DeviceID property and the Win32_DiskDriveToDiskPartition association class. Now you have a collection of the partitions on the physical drive.
Query for the Win32_LogicalDisk that represents the partition using the Win32_DiskPartition.DeviceID property and Win32_LogicalDiskToPartition association class.
Get the drive letter from the Win32_LogicalDisk.DeviceID.
|