Hi,
I want to delete files with a specific filename pattern older than a specific date. I search for the files with a query and check "lastmodified".
It worked fine on my XP system but when I run it on an W2K server it fails.
Boils down to a problem with the query:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService. _
ExecQuery("Select * from CIM_DataFile where drive='C:' and path = '\\' and name LIKE 'c:\\moremem.b%' ")
For Each objFile in colFiles
Wscript.Echo objFile.Name & " -- " & Left (objfile.lastmodified,8)
Next
On the W2K The query crashes and I get an error 80041017
When I change the "LIKE" to an "= 'c:\\moremem.bat' it does find the file.
Anyone got an idea what is wrong ?
Regards,
Boeboes
I want to delete files with a specific filename pattern older than a specific date. I search for the files with a query and check "lastmodified".
It worked fine on my XP system but when I run it on an W2K server it fails.
Boils down to a problem with the query:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService. _
ExecQuery("Select * from CIM_DataFile where drive='C:' and path = '\\' and name LIKE 'c:\\moremem.b%' ")
For Each objFile in colFiles
Wscript.Echo objFile.Name & " -- " & Left (objfile.lastmodified,8)
Next
On the W2K The query crashes and I get an error 80041017
When I change the "LIKE" to an "= 'c:\\moremem.bat' it does find the file.
Anyone got an idea what is wrong ?
Regards,
Boeboes