I run the script on me dev server (2003 SP1) and it runs fine. I run it in our test environment (2003 SP2) and I get a permission denied run time error. I am running it under an account with admin privledges to the server. Is there something with SP2 and vb scripts that doesn't play nice? Here is the script for review:
Dim fso, f, f1, fc
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("D:\Program Files\aaaaa\bbbb\logfiles")
Set fc = f.Files
For Each f1 in fc
If DateDiff("d", f1.DateLastModified, Now) > 14 Then f1.Delete
Next
Dim fso, f, f1, fc
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("D:\Program Files\aaaaa\bbbb\logfiles")
Set fc = f.Files
For Each f1 in fc
If DateDiff("d", f1.DateLastModified, Now) > 14 Then f1.Delete
Next