quasimodo Posted May 25, 2016 Share Posted May 25, 2016 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 More sharing options...
rootx Posted May 25, 2016 Share Posted May 25, 2016 $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 Synapsee and quasimodo 2 Link to comment Share on other sites More sharing options...
quasimodo Posted May 27, 2016 Author Share Posted May 27, 2016 @rootx Thank you very much for this script. Seems that wmic opens a quit new view inside windows! But there is a secret left: Why do you insert "@ComSpec" a second time into the run() command? It's working without it, too. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now