Need a script to scan computers for mp3 files and generate a list

Posted on 2011-04-27
Last Modified: 2012-05-11
I need a script to scan a list of computers (that are part of an OU in a domain) for mp3 (or other audio and video) files and generate a list.
Question by:Ehab Salem
    LVL 27

    Assisted Solution

    I don't have script to do that, but here is a program that will do what you're asking:

    Hope that helps.
    LVL 14

    Accepted Solution

    The sample vbscript below will read from a file (C:\Computers.txt) and search all the "mp3" & "wma" files in C: drive, then output to a log file (C:\Files.log).

    This will take some time to run.

    strComputerList = "C:\Computers.txt"
    strFileList = "C:\Files.log"
    Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")
    arrComputers = Split(objFSO.OpenTextFile(strComputerList).ReadAll, vbCrLf)
    For Each strComputer in arrComputers
    	Dim objOut : Set objOut = objFSO.CreateTextFile (strFileList)
    	Dim objWMI : Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    	Dim colFiles : Set colFiles = objWMI.ExecQuery ("Select * from CIM_Datafile Where Drive = 'C:' And (Extension = 'mp3' OR Extension = 'wma')")
    	For Each objFile in colFiles
    		objOut.WriteLine strComputer & ": " & objFile.Name
    	Set objOut = Nothing
    	Set colFiles = Nothing  
    	Set objWMI = Nothing
    Set objFSO = Nothing
    msgbox "done!"

    Open in new window

    LVL 23

    Expert Comment

    Dir *.mp3 /s > c:\mp3list.txt
    LVL 14

    Author Closing Comment

    by:Ehab Salem
    Thank you.
    Although Mitchko solution is great I cannot use it for 2 reasons:
    1- The domain contains hundreds of computers and the list is (for me) more practical.
    2- I am not allowed to install freeware.
    LVL 27

    Expert Comment

    I'm glad you got what you needed - and thank you for the assist.
    Best of luck to you.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    If your system is showing symptoms of browser hijacks or 'google search redirects' check out my other article ( first and run the tool TDSSKiller ( to get rid of the infection. Once done, and if the …
    This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now