disk_status.csv
==============================================================
Date,DiskName,DiskSize,FreeSpace,
==============================================================
disk_status.vbs
==============================================================
strComputer = "."
strDisks="C,D,E"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!//" & strComputer & "/root/cimv2")
Set colDisks = objWMIService.ExecQuery _
("Select * from Win32_LogicalDisk")
For each objDisk in colDisks
If InStr(strDisks,Left(objDisk.Name,1))>0 Then
Wscript.Echo Date & "," & objDisk.Name & "," & Round(objDisk.FreeSpace/1024/1024,3) & "," & Round(objDisk.Size/1024/1024,3)
End if
Next
==============================================================
运行 cscript.exe disk_status.vbs >>disk_status.csv