I have wrote a vbscript to find 180days old log file from C drive. Now the problem in below script is , I am able to get all the log file details from C drive.But not 180days old. Can anyone help me to correct my script please.

```
strComputer = "."
Dim objFile,iDaysOld,item,objFSO,dateTime,Filesize,LargeFile,strCheckDate
Dim FileName,FileName1,Logs,GetFile,file,filemodified,OldFile,LargeFile1
iDaysOld = 180
Set dateTime = CreateObject("WbemScripting.SWbemDateTime")
Set wmi = GetObject("winmgmts:\\.\root\cimv2")
Set files = wmi.ExecQuery("Select * from CIM_DataFile Where Extension='log' AND Drive='C:'")
For Each file in files
If LCase(Right(Cstr(file.Name), 3)) = "log" Then
        FileName1 = Trim(file.Name)
        FileName = (file.Name & "," & FileName)
        Filesize= (file.FileSize)
filemodified = file.lastModified
filemodified = left (filemodified, 8 )
filemodified = Month(Date) & "_" & Day(Date) & "_" & Year(Date)
strCheckDate = strDateCreated
strCheckDate = strDateAccessed
strCheckDate = strDateModified
If strCheckDate < (Date() - iDaysOld) Then
OldFile = (file.Name & "," & OldFile)
End If 
If Filesize >= 104857600 Then
LargeFile = (file.Name & "," & LargeFile)
' oFile.Delete(True) 
    End If 
End If 
Next
wscript.echo "tr_Oldlogfiles=" &OldFile
wscript.echo "tr_Largelogfiles=" &LargeFile

```