1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| But = "C'est un script qui prend plusieurs lecteurs en paramêtre affiche le nom du volume,"&vbcr&_
"le type de lecteur (amovible, fixe, réseau virtuel, le système de fichiers et l'espace libre et occupé en Go."
Titre = wscript.ScriptName
MsgBox "Nous sommes le " & Now & vbcr & Titre & " : "& But,64,Titre
Call DiskInfo
Sub DiskInfo
Dim objFSO, colDrives, objDrive, aff, tempaff
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set colDrives = objFSO.Drives
For Each objDrive in colDrives
if (objDrive.IsReady = true) then
EspaceLibre = objDrive.AvailableSpace
EspaceTotal = objDrive.TotalSize
EspaceLibrePc = EspaceLibre / EspaceTotal
aff = aff & vbcrlf & vbcrlf & "LETTRE DU DISQUE : " & objDrive.DriveLetter & vbcrlf
aff = aff & "NOM DU DISQUE : " & objDrive.VolumeName & vbcrlf
aff = aff & "NUMERO DE SERIE : " & objDrive.SerialNumber & vbcrlf
aff = aff & "TYPE DE DISQUE : " & DiskType (objDrive.DriveType) & vbcrlf
aff = aff & "SYSTEME DE FICHIERS : " & objDrive.FileSystem & vbcrlf
aff = aff & "PATH : " & objDrive.Path & vbcrlf
aff = aff & "DOSSIER RACINE : " & objDrive.RootFolder & vbcrlf
aff = aff & "ESPACE TOTAL : " & round(EspaceTotal/1073741824,2) & " Go" & vbcrlf
aff = aff & "ESPACE DISPONIBLE : " & round(EspaceLibre/1073741824,2) & " Go" & " (" & FormatPercent(EspaceLibrePc) &")" & vbcrlf
if (objDrive.ShareName <> "") then
aff = aff & vbcrlf & "NOM DE PARTAGE : " & objDrive.ShareName
end if
else
aff = aff& vbcrlf& vbcrlf & "DISQUE " & objDrive.DriveLetter & " NON PRET" & vbcrlf
aff = aff & "TYPE DE DISQUE : " & DiskType (objDrive.DriveType)
end if
Next
MsgBox colDrives.count & " DISQUES AFFICHES" & vbcrlf & aff,64,Titre
End Sub
Function DiskType (ByVal dType)
Dim affType
Select Case dType
Case 0 : affType = "INCONNU"
Case 1 : affType = "DISQUE AMOVIBLE"
Case 2 : affType = "FIXE"
Case 3 : affType = "DISTANT"
Case 4 : affType = "CD-ROM"
Case 5 : affType = "RAMDISK"
End Select
DiskType = affType
End Function |
Partager