Jump to content

How To List Hiden Partition In AutoIt..


Recommended Posts

DrivegetDrive only enumerates drives.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

This script (created using ) should give you information about your partitions (if it works for hidden partitions - I don't know):

; Generated by AutoIt Scriptomatic

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"

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

If IsObj($colItems) then
   For $objItem In $colItems
      $Output = $Output & "Access: " & $objItem.Access & @CRLF
      $Output = $Output & "Availability: " & $objItem.Availability & @CRLF
      $Output = $Output & "BlockSize: " & $objItem.BlockSize & @CRLF
      $Output = $Output & "Bootable: " & $objItem.Bootable & @CRLF
      $Output = $Output & "BootPartition: " & $objItem.BootPartition & @CRLF
      $Output = $Output & "Caption: " & $objItem.Caption & @CRLF
      $Output = $Output & "ConfigManagerErrorCode: " & $objItem.ConfigManagerErrorCode & @CRLF
      $Output = $Output & "ConfigManagerUserConfig: " & $objItem.ConfigManagerUserConfig & @CRLF
      $Output = $Output & "CreationClassName: " & $objItem.CreationClassName & @CRLF
      $Output = $Output & "Description: " & $objItem.Description & @CRLF
      $Output = $Output & "DeviceID: " & $objItem.DeviceID & @CRLF
      $Output = $Output & "DiskIndex: " & $objItem.DiskIndex & @CRLF
      $Output = $Output & "ErrorCleared: " & $objItem.ErrorCleared & @CRLF
      $Output = $Output & "ErrorDescription: " & $objItem.ErrorDescription & @CRLF
      $Output = $Output & "ErrorMethodology: " & $objItem.ErrorMethodology & @CRLF
      $Output = $Output & "HiddenSectors: " & $objItem.HiddenSectors & @CRLF
      $Output = $Output & "Index: " & $objItem.Index & @CRLF
      $Output = $Output & "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF
      $Output = $Output & "LastErrorCode: " & $objItem.LastErrorCode & @CRLF
      $Output = $Output & "Name: " & $objItem.Name & @CRLF
      $Output = $Output & "NumberOfBlocks: " & $objItem.NumberOfBlocks & @CRLF
      $Output = $Output & "PNPDeviceID: " & $objItem.PNPDeviceID & @CRLF
      $strPowerManagementCapabilities = $objItem.PowerManagementCapabilities(0)
      $Output = $Output & "PowerManagementCapabilities: " & $strPowerManagementCapabilities & @CRLF
      $Output = $Output & "PowerManagementSupported: " & $objItem.PowerManagementSupported & @CRLF
      $Output = $Output & "PrimaryPartition: " & $objItem.PrimaryPartition & @CRLF
      $Output = $Output & "Purpose: " & $objItem.Purpose & @CRLF
      $Output = $Output & "RewritePartition: " & $objItem.RewritePartition & @CRLF
      $Output = $Output & "Size: " & $objItem.Size & @CRLF
      $Output = $Output & "StartingOffset: " & $objItem.StartingOffset & @CRLF
      $Output = $Output & "Status: " & $objItem.Status & @CRLF
      $Output = $Output & "StatusInfo: " & $objItem.StatusInfo & @CRLF
      $Output = $Output & "SystemCreationClassName: " & $objItem.SystemCreationClassName & @CRLF
      $Output = $Output & "SystemName: " & $objItem.SystemName & @CRLF
      $Output = $Output & "Type: " & $objItem.Type & @CRLF
      if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
      $Output=""
   Next
Else
   Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_DiskPartition" )
Endif


Func WMIDateStringToDate($dtmDate)

    Return (StringMid($dtmDate, 5, 2) & "/" & _
    StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _
    & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2))
EndFunc

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Then I'm running out of ideas ;)

Maybe the UDF offers some functions?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

To start, you'll want to be able to know what you are looking for!

What paritition type does your part have? Some may have a type 0x27, although other values may exist. You can confirm the type using Diskpart. Example...

DISKPART> sel disk 0

Disk 0 is now the selected disk.

DISKPART> list part

  Partition ###  Type             Size   Offset
  -------------  ----------------  -------  -------
  Partition 1    Primary            500 MB  1024 KB
  Partition 2    Recovery         6000 MB   501 MB
  Partition 3    Primary             68 GB  6501 MB

DISKPART> sel part 2

Partition 2 is now the selected partition.

DISKPART> detail part

Partition 2
Type  : 27
Hidden: Yes
Active: No
Offset in Bytes: 525336576

  Volume ###  Ltr  Label        Fs   Type       Size     Status  Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
* Volume 4       Recovery    NTFS   Partition   6000 MB  Healthy    Hidden

DISKPART>

Presumably, the 0x27 would also be returned using a call to this:

http://msdn.microsoft.com/en-us/library/windows/desktop/aa365450%28v=vs.85%29.aspx

There doesn't seem to be a WMI object other than DiskPartition to look in, but it should show up on there. Disk 0, Part 0 should return a type of "Unknown" which should match how Disk Management deals with it. Aka it can't do anything with it. I don't think Windows has the appropriate ability to return the partition type. So you'll either need to automate Diskpart or use the API calls it uses.

Then again, this all presumes you are using at least Vista.

Link to comment
Share on other sites

Microsoft DiskPart version 5.1.3565

Copyright © 1999-2003 Microsoft Corporation.

DISKPART> list volume

Volume ### Ltr Label Fs Type Size Status Info

---------- --- ----------- ----- ---------- ------- --------- --------

Volume 0 C Windows Xp NTFS Partition 83 GB Healthy System

Volume 1 D Dokumen NTFS Partition 215 GB Healthy

DISKPART>

How To Read Label with AutoIt from Diskpart Not from drivegetlabel

when type list volume in diskpart autoit will display "volume 0 label is Windows Xp info System.."

Create list.txt

type list volume in list.txt

Run(@ComSpec & " /k diskpart.exe /s list.txt") wih autoit

How To display in autoit

"volume 0 label is Windows Xp info System.."

Edited by penggilas2
Link to comment
Share on other sites

Should list all partitions:

$RET = DllCall("Kernel32.dll", "int", "FindFirstVolume", "str", "", "str",  255)
ConsoleWrite($RET[1] & @TAB & DriveGetLabel($RET[1]) & @CRLF)
$RET[1] = $RET[0]
while 1
$RET = DllCall("Kernel32.dll", "int", "FindNextVolume", "int", $RET[1], "str", "", "str",  255)
IF Not $RET[0] Then ExitLoop
ConsoleWrite($RET[2] & @TAB & DriveGetLabel($RET[2]) & @CRLF)
WEnd
Link to comment
Share on other sites

  • 6 months later...

hey, you can use dos command line to get your info.

create a file : test.txt

content :

-------------------

sel dis 0

lis par

-------------------

Create another file: b.bat

----------------------------------------------

diskpart /s test.txt > diskpartition.log

----------------------------------------------

then you run b.bat. then you can get a diskpartition.log. the content of diskpartition.log is what you want.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...