How to get windows system reserve & OEM reserve disk partition

161 views
Skip to first unread message

ilookface

unread,
Dec 17, 2012, 3:51:18 AM12/17/12
to qda_...@googlegroups.com
Hi guys:

Two questions:

1. I want to get the windows all volumes, but the autoit  function DriveGetDrive( "Fixed" ) just only list the volume which has named.

something like this :

DISKPART> lis par

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    Primary            100 MB  1024 KB
  Partition 2    Primary            102 GB   101 MB
  Partition 0    Extended           344 GB   102 GB
  Partition 4    Logical            100 GB   102 GB
  Partition 5    Logical             97 GB   202 GB
  Partition 6    Logical            146 GB   299 GB
  Partition 3    OEM                 19 GB   446 GB

Any ideas?

this is the same question at autoit forums :

2. How to detect the disk partition is GPT / MBR ?

using diskpart ?

lis dis 

DISKPART> lis dis

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          465 GB  3072 KB

Arthur

unread,
Dec 17, 2012, 9:35:19 AM12/17/12
to qda_...@googlegroups.com
some tips about these two question::

1. using WMI  "Win32_DiskDrive" :: Get Number of partitions on this physical disk drive that are recognized by the operating system .
$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly
= 0x20
$colItems
= ""
$strComputer
= "localhost"


$Output
=""
$Output
&= "Computer: " & $strComputer  & @CRLF
$Output
&= "==========================================" & @CRLF
$objWMIService
= ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems
= $objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive", "WQL", _
  $wbemFlagReturnImmediately
+ $wbemFlagForwardOnly)


If IsObj($colItems) then
   
For $objItem In $colItems
  $Output
&= "Availability: " & $objItem.Availability & @CRLF
  $Output
&= "BytesPerSector: " & $objItem.BytesPerSector & @CRLF
  $strCapabilities
= $objItem.Capabilities(0)
  $Output
&= "Capabilities: " & $strCapabilities & @CRLF
  $strCapabilityDescriptions
= $objItem.CapabilityDescriptions(0)
  $Output
&= "CapabilityDescriptions: " & $strCapabilityDescriptions & @CRLF
  $Output
&= "Caption: " & $objItem.Caption & @CRLF
  $Output
&= "CompressionMethod: " & $objItem.CompressionMethod & @CRLF
  $Output
&= "ConfigManagerErrorCode: " & $objItem.ConfigManagerErrorCode & @CRLF
  $Output
&= "ConfigManagerUserConfig: " & $objItem.ConfigManagerUserConfig & @CRLF
  $Output
&= "CreationClassName: " & $objItem.CreationClassName & @CRLF
  $Output
&= "DefaultBlockSize: " & $objItem.DefaultBlockSize & @CRLF
  $Output
&= "Description: " & $objItem.Description & @CRLF
  $Output
&= "DeviceID: " & $objItem.DeviceID & @CRLF
  $Output
&= "ErrorCleared: " & $objItem.ErrorCleared & @CRLF
  $Output
&= "ErrorDescription: " & $objItem.ErrorDescription & @CRLF
  $Output
&= "ErrorMethodology: " & $objItem.ErrorMethodology & @CRLF
  $Output
&= "FirmwareRevision: " & $objItem.FirmwareRevision & @CRLF
  $Output
&= "Index: " & $objItem.Index & @CRLF
 
;$Output &= "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF
  $Output
&= "InterfaceType: " & $objItem.InterfaceType & @CRLF
  $Output
&= "LastErrorCode: " & $objItem.LastErrorCode & @CRLF
  $Output
&= "Manufacturer: " & $objItem.Manufacturer & @CRLF
  $Output
&= "MaxBlockSize: " & $objItem.MaxBlockSize & @CRLF
  $Output
&= "MaxMediaSize: " & $objItem.MaxMediaSize & @CRLF
  $Output
&= "MediaLoaded: " & $objItem.MediaLoaded & @CRLF
  $Output
&= "MediaType: " & $objItem.MediaType & @CRLF
  $Output
&= "MinBlockSize: " & $objItem.MinBlockSize & @CRLF
  $Output
&= "Model: " & $objItem.Model & @CRLF
  $Output
&= "Name: " & $objItem.Name & @CRLF
  $Output
&= "NeedsCleaning: " & $objItem.NeedsCleaning & @CRLF
  $Output
&= "NumberOfMediaSupported: " & $objItem.NumberOfMediaSupported & @CRLF
  $Output
&= "Partitions: " & $objItem.Partitions & @CRLF
  $Output
&= "PNPDeviceID: " & $objItem.PNPDeviceID & @CRLF
  $strPowerManagementCapabilities
= $objItem.PowerManagementCapabilities(0)
  $Output
&= "PowerManagementCapabilities: " & $strPowerManagementCapabilities & @CRLF
  $Output
&= "PowerManagementSupported: " & $objItem.PowerManagementSupported & @CRLF
  $Output
&= "SCSIBus: " & $objItem.SCSIBus & @CRLF
  $Output
&= "SCSILogicalUnit: " & $objItem.SCSILogicalUnit & @CRLF
  $Output
&= "SCSIPort: " & $objItem.SCSIPort & @CRLF
  $Output
&= "SCSITargetId: " & $objItem.SCSITargetId & @CRLF
  $Output
&= "SectorsPerTrack: " & $objItem.SectorsPerTrack & @CRLF
  $Output
&= "SerialNumber: " & $objItem.SerialNumber & @CRLF
  $Output
&= "Signature: " & $objItem.Signature & @CRLF
  $Output
&= "Size: " & Round($objItem.Size/1024^3, 2) & "Gb" & @CRLF
  $Output
&= "Status: " & $objItem.Status & @CRLF
  $Output
&= "StatusInfo: " & $objItem.StatusInfo & @CRLF
  $Output
&= "SystemCreationClassName: " & $objItem.SystemCreationClassName & @CRLF
  $Output
&= "SystemName: " & $objItem.SystemName & @CRLF
  $Output
&= "TotalCylinders: " & $objItem.TotalCylinders & @CRLF
  $Output
&= "TotalHeads: " & $objItem.TotalHeads & @CRLF
  $Output
&= "TotalSectors: " & $objItem.TotalSectors & @CRLF
  $Output
&= "TotalTracks: " & $objItem.TotalTracks & @CRLF
  $Output
&= "TracksPerCylinder: " & $objItem.TracksPerCylinder & @CRLF
 
if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
  $Output
=""
   
Next
Else
   
Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_DiskDrive" )
Endif

2. Refer to WinAPIEx UDF to get some disk driver function to get more info about disk.
    "_WinAPI_GetDriveGeometryEx"......
3. Refer to MSDN get more info about :: "IOCTL_DISK_GET_DRIVE_LAYOUT_EX ","DRIVE_LAYOUT_INFORMATION_EX "

Reply all
Reply to author
Forward
0 new messages