Scan Local Drives

Scan Local Drives Average ratng: 4,4/5 7461 votes

I've been doing some scripting off and on for the past year and I've gotten alot of my information from this place so I'm hoping someone out there has an answer for this. I'm trying to create a VBscript that scans only local drives on a workstation to search for a paticular file. In the past I've used the WMI database, specifically the CIMDataFile class to scan the workstation looking for a paticular file. It does work, however the scan takes a very long time and uses alot of CPU, especially if anyone has a network drive mapped on their workstations. For example I have a simple script that looks for the file example.txt in CIMDataFile class.-Start of Script-. Set objWMI = GetObject('winmgmts:.

  1. Scan Local Police Radio

Scan Local Police Radio

Local

Root cimv2') FileQuery = 'SELECT Name FROM CIMDataFile WHERE filename = 'example' AND extension = 'txt' Set colFiles = objWMI.ExecQuery(FileQuery) For Each objFile in colFiles WScript.Echo objFile.Name Next WScript.Echo 'File Scan Finished'.-End of Script-. Now it works fine but I have two local drives (C: and D: ) and a mapped network drive (P: ) to our massive file server. This simple script took over 3 hours to complete before I got my 'File Scan Finished' popup and chewed up a lot of CPU resources during that time.

Local

I know I could put a 'WHERE Drive='C:' OR Drive='D:' at the end of the query to have it specifically search C: and D: but the plan is to send this script out to every workstation in the company and I'm sure people probably have the CD drive mapped to D: and then have an E: drive partition or someone may have multiple partitions. I am hoping there is something simple that I'm missing, any information would be greatly appreciated.

WMI is a wonderful thing but speed is not one of its qualities. It is about as slow as a pregnant rhino when processing files. With VB Script you will get the best speed if you use a hybrid code, one that combines the speed of the Command Processor with the flexibility of VB Scripting. Try this code.

You will find that it runs between 100 and 200 times faster than the equivalent WMI code.

This item WD 1TB My Passport for Mac Portable External Hard Drive, USB-C/USB-A - WDBFKF0010BBK-WESE Toshiba HDTB410XK3AA Canvio Basics 1TB Portable External Hard Drive USB 3.0, Black #1 New Release. WD 1TB My Passport for Mac Portable external Hard Drive - USB-C/ USB-A Ready See more like this SPONSORED USB 3.0 Cable for Western Digital WD My Passport SE Mac Hard Drive 1TB 1.5TB 2TB. Wd hard disk 1tb price. Free Shipping. I-O DATA Portable Hard Disk Drive 1TB My Passport for Mac Japan with Tracking See more like this. Western Digital My Passport for Mac 1TB Portable External Hard Drive Disk 1 TB See more like this. Buy Used and Save: Buy a Used 'WD 1TB Black My Passport Portable External Hard D.' And save 43% off the $80.00 list price. And save 43% off the $80.00 list price. Buy with confidence as the condition of this item and its timely delivery are guaranteed under the 'Amazon A-to-z Guarantee'.

Posted on  by  admin