Datafile problem

G

Guest

when i write a script using properties of "datafile" clss in WMI, it doesn't
work. I mean it doesn't return anything. is there something wrong with
datafile of WMI.?

how can i fix this problem.?

thanks
 
T

Torgeir Bakken \(MVP\)

CuriousMe said:
when i write a script using properties of "datafile" clss in
WMI, it doesn't work. I mean it doesn't return anything. is
there something wrong with datafile of WMI.?

how can i fix this problem.?
Hi,

CIM_DataFile works fine for me.

Could you please post a short script (exactly just as you run it)
that does not work for you?
 
G

Guest

thank you for your response. Please tell me what i can do to fix this
problem. Here is the script
================================
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")

Set colFiles = objWMIService.ExecQuery("SELECT * FROM CIM_DataFile where
Path = 'c:\\php5\\'")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Directory where
Path = 'c:\\php5\\'")

For Each objFile in colFiles
Wscript.Echo "Name: " & objFile.Name
Next

For Each objItem In colItems

WScript.Echo "Status: " & objItem.Status
WScript.Echo "System: " & objItem.System
WScript.Echo "Writeable: " & objItem.Writeable

Next


================================

==============Error log==============
(Thu Jun 30 07:18:52 2005.288328) : WDM call returned error: 4200
(Thu Jun 30 08:42:39 2005.5314781) : WDM call returned error: 4200
(Thu Jun 30 08:59:56 2005.6352234) : WDM call returned error: 4200

(Thu Jun 30 07:16:05 2005.120656) : NT Event Log Consumer: could not
retrieve sid, 0x80041002
(Thu Jun 30 07:16:05 2005.120656) : NT Event Log Consumer: could not
retrieve sid, 0x80041002
(Thu Jun 30 07:16:05 2005.120656) : NT Event Log Consumer: could not
retrieve sid, 0x80041002
(Thu Jun 30 07:16:05 2005.120656) : NT Event Log Consumer: could not
retrieve sid, 0x80041002
(Thu Jun 30 07:16:05 2005.120656) : NT Event Log Consumer: could not
retrieve sid, 0x80041002
(Thu Jun 30 07:19:51 2005.347093) : NT Event Log Consumer: could not
retrieve sid, 0x80041002
(Thu Jun 30 07:19:51 2005.347109) : NT Event Log Consumer: could not
retrieve sid, 0x80041002
(Thu Jun 30 08:14:56 2005.3651828) : NT Event Log Consumer: could not
retrieve sid, 0x80041002

==============end error log===========
 
T

Torgeir Bakken \(MVP\)

CuriousMe said:
thank you for your response. Please tell me what i can do to fix this
problem. Here is the script
================================
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")

Set colFiles = objWMIService.ExecQuery("SELECT * FROM CIM_DataFile where
Path = 'c:\\php5\\'")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Directory where
Path = 'c:\\php5\\'")
Hi,

Change your two instances of

where Path = 'c:\\php5\\'

to

where Drive = 'C:' AND Path = '\\php5\\'


Your script started to work for me with that change.
 
D

Dick Sutton

I know I'm gonna probably regret this, but why does that work and the
original code not work? I would have never coded it that way!

Dick
 
G

Guest

Using Name and Path property in CIM_DATAFILE and Win32_Directory can be
frustrating.

1 thing that i notice about WMI scripting is you can run a script and still
don't know what happens because there is no error pop up.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top