Hi
I am trying to find all the index.dat files on machines so that I can colect information about them.
The ones that I am looking for are in the profile directories on w2k machines - general path of C:\Documents and Settings\<profile folder>\cookies
I have written the following script (OK I used scriptomatic 2.0) to try and get this information
On Error Resume Next
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
arrComputers = Array("WINTELCY")
For Each strComputer In arrComputers
WScript.Echo
WScript.Echo "=========================================="
WScript.Echo "Computer: " & strComputer
WScript.Echo "=========================================="
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM CIM_DataFile WHERE Drive = 'C:' AND FileName = 'index'", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
'WScript.Echo "CreationDate: " & WMIDateStringToDate(objItem.CreationDate)
WScript.Echo "Drive: " & objItem.Drive
WScript.Echo "Extension: " & objItem.Extension
WScript.Echo "FileName: " & objItem.FileName
WScript.Echo "LastAccessed: " & WMIDateStringToDate(objItem.LastAccessed)
WScript.Echo "LastModified: " & WMIDateStringToDate(objItem.LastModified)
WScript.Echo "Name: " & objItem.Name
WScript.Echo "Path: " & objItem.Path
WScript.Echo
Next
Next
Function WMIDateStringToDate(dtmDate)
WScript.Echo dtm:
WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) & "/" & _
Mid(dtmDate, 7, 2) & "/" & Left(dtmDate, 4) _
& " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) & ":" & Mid(dtmDate,13, 2))
End Function
When I run this script I do get information back about index files but none of them are in the documents and settings folder, they all sit in the Windows folders.
When I change the query to this:
"SELECT * FROM CIM_DataFile WHERE Drive = 'C:' AND Path = '\\Documents and Settings\\' AND FileName = 'index'"
just to see if I can see any files in this folder. It doesn't return anything.
I have browsed my machine and there are files in there called 'index'
Can anyone tell me why this script will not see in the documents and settings folder?
Colin
I am trying to find all the index.dat files on machines so that I can colect information about them.
The ones that I am looking for are in the profile directories on w2k machines - general path of C:\Documents and Settings\<profile folder>\cookies
I have written the following script (OK I used scriptomatic 2.0) to try and get this information
On Error Resume Next
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
arrComputers = Array("WINTELCY")
For Each strComputer In arrComputers
WScript.Echo
WScript.Echo "=========================================="
WScript.Echo "Computer: " & strComputer
WScript.Echo "=========================================="
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM CIM_DataFile WHERE Drive = 'C:' AND FileName = 'index'", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
'WScript.Echo "CreationDate: " & WMIDateStringToDate(objItem.CreationDate)
WScript.Echo "Drive: " & objItem.Drive
WScript.Echo "Extension: " & objItem.Extension
WScript.Echo "FileName: " & objItem.FileName
WScript.Echo "LastAccessed: " & WMIDateStringToDate(objItem.LastAccessed)
WScript.Echo "LastModified: " & WMIDateStringToDate(objItem.LastModified)
WScript.Echo "Name: " & objItem.Name
WScript.Echo "Path: " & objItem.Path
WScript.Echo
Next
Next
Function WMIDateStringToDate(dtmDate)
WScript.Echo dtm:
WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) & "/" & _
Mid(dtmDate, 7, 2) & "/" & Left(dtmDate, 4) _
& " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) & ":" & Mid(dtmDate,13, 2))
End Function
When I run this script I do get information back about index files but none of them are in the documents and settings folder, they all sit in the Windows folders.
When I change the query to this:
"SELECT * FROM CIM_DataFile WHERE Drive = 'C:' AND Path = '\\Documents and Settings\\' AND FileName = 'index'"
just to see if I can see any files in this folder. It doesn't return anything.
I have browsed my machine and there are files in there called 'index'
Can anyone tell me why this script will not see in the documents and settings folder?
Colin