Hey Pete, you might have a look at how Dr. David Allen does it in the Logical Disk Extension MP. Perhaps something their you can repurpose.
http://www.systemcentercentral.com/pack-catalog/logical-disk-extension-management-pack/ Regards, Pete Zerger, vTSP, MVP (System Center Cloud and Datacenter Management) Founder, System Center Central: http://www.systemcentercentral.com Azure IaaS Book (coming soon) http://InsideTheMicrosoftCloud.com On Fri, Oct 24, 2014 at 11:17 AM, Pete Hakesley <[email protected]> wrote: > 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] <[email protected]>* | w: www.scc.com > a: SCC, CV1, Cole Valley, 20 Westwood Avenue, Tyseley, Birmingham B11 3RZ > > > > > > > >
