Then I would change the wmi query to a string and pass that.

strWMIQuery = ("SELECT * FROM Win32_LogicalDisk Where DeviceID = '"&
strSomeVar &"')"
Set colDisks = objWMIService.ExecQuery(strWMIQuery)

On Tue, Sep 23, 2008 at 11:16 AM, Joseph L. Casale <
[EMAIL PROTECTED]> wrote:

>  Well, I changed the script a great deal. I made a function out of the
> query and just call it twice.
> How can I pass a value for a drive letter into objWMIService.ExecQuery?
>
>
>
> Set colDisks = objWMIService.ExecQuery("SELECT * FROM Win32_LogicalDisk
> Where DeviceID = 'L:'")
>
>
>
> Would need to be:
>
>
>
> Set colDisks = objWMIService.ExecQuery("SELECT * FROM Win32_LogicalDisk
> Where DeviceID = strSomeVar")
>
>
>
> Then my function would be SomeFunc("'L:'") as the DeviceID needs to be 'L:'
> for example?
>
> Thanks,
> jlc
>
>
>
> *From:* Eric Woodford [mailto:[EMAIL PROTECTED]
> *Sent:* Tuesday, September 23, 2008 12:04 PM
> *To:* NT System Admin Issues
> *Subject:* Re: VBScript Issue
>
>
>
> how about
>
>
>
> using the array index?
>
>
>
> colDisks(0)
>
> On Tue, Sep 23, 2008 at 9:57 AM, Joseph L. Casale <
> [EMAIL PROTECTED]> wrote:
>
> I am trying to monitor the disc space on a specific drive, I am using:
>
>
>
> Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
>
> Set colDisks = objWMIService.ExecQuery("SELECT * FROM Win32_LogicalDisk
> Where DeviceID = 'L:'", "WQL", wbemFlagReturnImmediately +
> wbemFlagForwardOnly)
>
>
>
> but this returns an array (right) even though its filtered to only return
> one object. How can I rewrite this to return an object so that I can call
> this multiple times getting the value at the point in time without needed to
> deal with like an array and loop through all "one" objects in it?
>
>
>
> Thanks!
> jlc
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

Reply via email to