Jump to content
Sign in to follow this  
Wingens

Pull down menu with disk info

Recommended Posts

Wingens

Hi,

i have build an installation GUI for our company's network installation for Vista/7/8.1.

Now i want to add a pull down menu wich shows me all HDD/SSD  that are available in the machine with the diskpart disknumber so that i can edit my answerfile for the creation of the partitions.

I know what i want but i don't know how to create it.

Can anyone help me with this?

You can find my script attached to the post.

Help would be appriciated.

 

Headsup: There could be al bit of dutch in the script.

V0.5 - Username.au3

Share this post


Link to post
Share on other sites
jguinch

Did you try a WMI query ?

Global Const $wbemFlagReturnImmediately = 0x10, $wbemFlagForwardOnly = 0x20

$oWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\CIMV2")
If $oWMIService = 0 Then Exit MsgBox(16, "Error", "WMI error")


$sQueryDisk = "select * from Win32_DiskDrive Where InterfaceType  != 'USB'"

$colDisk = $oWMIService.ExecQuery($sQueryDisk, "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If NOT IsObj($colDisk) Then Exit MsgBox(16, "Error", "Unable to detect any disk drive")

For $oDisk In $colDisk
    ConsoleWrite( @CRLF & "####################################" & @CRLF & _
        "Disk Model : " & @TAB & $oDisk.Model & @CRLF & _
        "Disk Number : " & @TAB & $oDisk.Index & @CRLF & _
        "Disk Size : " & @TAB & $oDisk.Size & @CRLF )
Next

Look at the >AutoIt Script-o-matic tool, it could help.

Share this post


Link to post
Share on other sites
Wingens

No i did not try that yet.

I will try to work on it this weekend, let you know if i can get it to work.

thx :)

Share this post


Link to post
Share on other sites
Wingens

Dim $sResult
$strComputer = "."

$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2")
$colItems = $objWMIService.ExecQuery("Select * from Win32_DiskDrive")

For $objItem In $colItems

    $sResult &= "" & $objItem.Caption & @LF & " (" & Int($objItem.Size / 1024 ^ 3) & "GB) |"


Next

#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>


$Form1 = GUICreate("Form1", 615, 438, -1, -1)

$Combo1 = GUICtrlCreateCombo("Kies schijf...", 128, 200, 369, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
    GUICtrlSetData($Combo1, $sResult)



GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd 

I did not get the script to work now, i have been searching and editting a little bit and i have come up with this script.

 

Only problem i have now it won't run in WinPE can anyone help me with this, i really am stuck with this part.

 

What i am trying to do here is: Create a pull down menu with the drives connected to the system in it, and after the drive is chosen and the start button is clicked it needs to be able to change a xml file for my diskpart function to work.

If chosen drive has disk 0 in diskpart then input that in the xml, but if chosen drive has disk 1 then that etc.

 

Hope you guys can help me with this.

  • Like 1

Share this post


Link to post
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
Sign in to follow this  

×