Hi all
Been using the various scripting and authoring guides I have a script I am
working on he get the below values from WMI
...Part of my script...
set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set colDrives = objWMI.ExecQuery("select Name from Win32_LogicalDisk")
for each strDrive in ColDrives
strDrive = strDrive.Name
If ((Mid(strDrive,2,1) <> ":") or (Len(strDrive)> 3)) Then
Exit For
Else
set colVols = objWMI.ExecQuery("Select * from Win32_Volume where
DriveType = 3 And DriveLetter = '" & strDrive & "'")
for each objVol in colVols
Set oBag =
oAPI.CreatePropertyBag()
oBag.AddValue "StatusInstance",
strDrive
oBag.AddValue "VolumeSize",
Int(objRpt.VolumeSize / 1073741824) <-- or The script fails at this point
oBag.AddValue "UsedSpace",
Int(objRpt.UsedSpace / 1073741824) <-- or The script fails at this point
oBag.AddValue "FreeSpace",
Int(objRpt.FreeSpace / 1073741824) <-- or The script fails at this point
oBag.AddValue
"FreeSpacePercent", objRpt.FreeSpacePercent <-- or The script fails at this
point
strVolumeSize =
objRpt.VolumeSize
strUsedSpace = objRpt.UsedSpace
strFreeSpace = objRpt.FreeSpace
strFreeSpacePercent =
objRpt.FreeSpacePercent
oAPI.Return(oBag)
Next
End If
Next
...End of part of the script ...
All I keep getting is Object required: " Code 800A01A8 Microsoft VBScript
runtime error
I think the code is syntactically correct but if anyone can help me - I am at
the hair pulling stage!
Peter Hakesley | Monitoring & Automation Technical Lead Engineer, Data Centre
Services
t: +44(0)845 155 6556 ext: 4006
e: [email protected] | w: www.scc.com<http://www.scc.com/>
a: SCC, CV1, Cole Valley, 20 Westwood Avenue, Tyseley, Birmingham B11 3RZ