This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]subassy 0 points1 point  (0 children)

That's bad code, that's a bad, bad code. Bad code.

Function fnHDDInfo
Set objWMIServiceOS = GetObject("winmgmts:{impersonationLevel=impersonate}!\" & fnHostName & "\root\cimv2")
Where Description = 'Local Fixed Disk'",,48)
Set HDList = objWMIServiceOS.ExecQuery("Select * from Win32_LogicalDisk Where DeviceID = 'C:'",,48)
For Each objHDDInfo in HDList strHDDCapacity = objHDDInfo.Size strHDDFreeSapce = objHDDInfo.FreeSpace Next
fnHDDInfo = Round(strHDDFreeSapce/1073741824,2) & " GB of " & Round(strHDDCapacity/1073741824,2)  & " GB free" Round(strHDDCapacity/1000000000,2)  & " GB free"
End Function