VBscript file search

Does anyone know if there is a way through VBscript to search an entire server for any occurance of a ".mdb" file and then write the finding information to an output file showing the name of the file, location, owner, date last accessed, date created, and date modified?

I really appreciate your help or suggestions.
Thanks
tesla764Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
How 'big' is your 'entire server' ?

If I did that here, even with the faster Cray supercomputer, it would probably take a looooong time.

mx
0
Rey Obrero (Capricorn1)Commented:
see the codes from this link

http://allenbrowne.com/ser-59.html

0
Jeffrey CoachmanMIS LiasonCommented:
...MX,
...isn't the "Owner" of the DB is something you would have to open the db file to determine....
(making this a bit more complex)
0
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

Bill PrewIT / Software Engineering ConsultantCommented:
Give this a try, save as a VBS script and adjust the starting folder.  Try it on a small subfolder first to get an idea if it's getting the info you want before you run it on a larger drive or share.  It will certainly take a while to search a large drive, no matter what tool you use.

sFolder = "c:\ee"

Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")

DoSearch oFSO.GetFolder(sFolder)

Sub DoSearch(oFolder)
   For Each oFile in oFolder.Files
      If LCase(Right(oFile.Name, 4)) = ".mdb" Then
         WScript.Echo "Name = " & oFile.Name
         WScript.Echo "Path = " & oFile.Path
         WScript.Echo "Owner = " & GetOwner(oFile.Path)
         WScript.Echo "DateLastAccessed = " & oFile.DateLastAccessed
         WScript.Echo "DateCreated = " & oFile.DateCreated
         WScript.Echo "DateLastModified = " & oFile.DateLastModified
         WScript.Echo "-------------------------------------"
      End If
   Next
   For Each oSubFolder In oFolder.Subfolders
      DoSearch(oSubFolder)
   Next
End Sub

Function GetOwner(sFile)
   Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

   Set cItems = oWMI.ExecQuery("ASSOCIATORS OF {Win32_LogicalFileSecuritySetting='" & sFile & "'} WHERE AssocClass=Win32_LogicalFileOwner ResultRole=Owner")

   For Each oItem in cItems
      GetOwner = oItem.ReferencedDomainName & "/" & oItem.AccountName
   Next
End Function

Open in new window

~bp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tesla764Author Commented:
Beautiful!! That's exactly what I was looking for.
Thanks!!!
0
Bill PrewIT / Software Engineering ConsultantCommented:
Welcome, glad that helped, thanks for the feedback.

~bp
0
tesla764Author Commented:
Thanks!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.