Does anyone know a way to return the Volume Number? I see there are DriveLetter and VolumeName options, but I really need to know the Volume Number before commiting a drive letter change in the script. Any ideas?
well specifically, if I use the resource kit utility 'diskpart' which is command line control of Disk Manager, then a volume has:
volume number
drive letter
volume name
and more
Thanks SF but this gave me partition numbers relating to the disk rather than the volume number.
What would work too I guess is if I could search the text output from running diskpart and then run a particular script if this was T or F. But I must admit my scripting days are few. Is this possible?
eg if in diskpart.txt there exists
Microsoft DiskPart version 5.1.3553
Copyright (C) 1999-2001 Microsoft Corporation.
On computer: LNEEML01
DiskPart is starting the disk management services.
Volume ### Ltr Label Fs Type Size Status Info
---------- --- ----------- ----- ---------- ------- --------- -------- Volume 0 F MAIL02 NTFS Simple 137 GB Healthy
Volume 1 E MAIL01 NTFS Simple 137 GB Healthy
Volume 2 R CD-ROM 0 B
Volume 3 C SYSTEM NTFS Partition 18 GB Healthy System
Volume 4 D OS_Utils NTFS Partition 16 GB Healthy
Then if I could match the string MAIL02 and take the volume number = 0 then i could get around it.
Try this, I am presuming that you already have the text file
Dim fso
Set fso = Wscript.Createobject("Scripting.FilesystemObject"
set diskpart = fspenTextFile("C:\Diskpart.txt",1)
newdetails = ""
Do Until diskpart.AtEndOfStream
strline = diskpart.ReadLine
If InStr(strline,"MAIL02" Then
details = split(Trim(strline)," "
for i = 0 to ubound(details) -1
If NOT details(i) = "" Then
newdetails = newdetails & "," & details(i)
End If
Next
list = Split(newdetails,","
Volume = list(1)
Volnumber = list(2)
dletter = list(3)
label = list(4)
msgbox volume & " " & volnumber & VBCrlf & "Drive Letter: " & dletter & VBCrlf & "Label: " & label
End If
Loop
diskpart.Close
Regards
Steve Friday
Thanks for your help, I used that script to determine the volume number and used that to run either set 0 or set 1 of a similar set of scripts on the RIGHT volume.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.