Jump to content

DriveGet.... including off-line drives


Recommended Posts

Hi,

I'm looking for a function which return ALL (windows)drive numbers and serial numbers inluding the drives which are currently set offline (e.g. by diskpart). The only "Drive..." function accepting a drive number seems to be "DriveGetType".  Even only getting the serial number of an off-line disk would help too.

 

 

Link to comment
Share on other sites

$wmic = Run(@ComSpec & " /c" & @ComSpec & ' /c ' & "wmic diskdrive get serialnumber","", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
    Local $Output = ""
    While 1
        $Output &= StdoutRead($wmic)
        If @error Then ExitLoop
    Wend
    $sOutput=StringSplit($Output,@CR)
    for $a=1 to $sOutput[0]
            ConsoleWrite($sOutput[$a])
    next
    
    $vol = Run(@ComSpec & " /c" & @ComSpec & ' /c ' & "vol C:","", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
    Local $Output = ""
    While 1
        $Output &= StdoutRead($vol)
        If @error Then ExitLoop
    Wend
    $sOutput=StringSplit($Output,@CR)
    for $a=1 to $sOutput[0]
            ConsoleWrite($sOutput[$a])
    next

 

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...