Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Looking for application on Logical Disk

13 views
Skip to first unread message

Gary Paquette

unread,
Apr 22, 2003, 11:43:09 AM4/22/03
to
I need to look for all EXE's on all local drives to get install applications
(they do not always show up in Add/Remove programs) - but when I use the
LogicalDisk class to pull that data - the system comes to a grinding halt.
Is there a more efficient way to get the information about all application
on the drives?

Gary


------------------------------------------
Gary Paquette

Marty List

unread,
Apr 22, 2003, 12:03:00 PM4/22/03
to

Which language are you writing in? Using the 'File System Object' you can
recursively enumerate all drives, folders and subfolders:

http://msdn.microsoft.com/library/en-us/script56/html/jsobjfilesystem.asp

"Gary Paquette" <gpaq...@incontroltechnology.com> wrote in message
news:uz1IiXOC...@TK2MSFTNGP10.phx.gbl...

Torgeir Bakken (MVP)

unread,
Apr 22, 2003, 12:38:14 PM4/22/03
to
Gary Paquette wrote:

> I need to look for all EXE's on all local drives to get install applications
> (they do not always show up in Add/Remove programs) - but when I use the
> LogicalDisk class to pull that data - the system comes to a grinding halt.
> Is there a more efficient way to get the information about all application
> on the drives?

Hi

Try using a semisynchronous call adding the wbemFlagForwardOnly flag for
optimization. When using ExecQuery for large data sets, you really *need* this
setting (especially on remote computers). More about this here:
http://groups.google.com/groups?selm=3E83A754.7E4EE295%40hydro.com

Also, in the select statement, don't use * (for all properties), but only select
the properties you need.


Try the following script with cscript.exe in a command prompt:


sComputerName = "." ' Use "." for local computer
sExtension = "exe"

Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}//" _
& sComputerName)

' get all local drives in a collection
Set oDriveSet = oWMI.ExecQuery _
("select Name from Win32_LogicalDisk where DriveType=3")

' get all files with the specified extension
For Each oDrive In oDriveSet
sWQL = "Select Name from CIM_DataFile where Drive='" _
& oDrive.Name & "' AND Extension='" & sExtension & "'"

Set oResult = oWMI.ExecQuery(sWQL,, 48)
For Each oFile In oResult
WScript.Echo "File: " & oFile.Name
Next
Next

--
torgeir
Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter


Gary Paquette

unread,
Apr 23, 2003, 10:50:21 AM4/23/03
to
We are writing the application in C++. When we perform a full recursive on
the local drives all other applications come to a crawl. This is testing it
on a P4 with 1Gig of RAM - would be scary to try on anything else.. The
ultimate plan would to have WMI store all the EXE and version data in the
CIM database where we could pull it from. I will look at the article -
thanks!

Gary

------------------------------------------
Gary Paquette
InControl Technology Inc.


"Marty List" <Bill....@sun.com> wrote in message
news:b83p3n$6586a$1...@ID-172409.news.dfncis.de...

[MS] Scott McNairy

unread,
Apr 23, 2003, 6:09:57 PM4/23/03
to
If you are using WMI to do your recursive look for exe's on the system some
things to know are that the provider that provides this information is
optimized on where conditionals for Extension, Path, and Name properties.

--
[MS] Scott McNairy
WMI Test Engineer
This posting is provided "As Is" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


"Gary Paquette" <gpaq...@incontroltechnology.com> wrote in message

news:e12ksea...@TK2MSFTNGP11.phx.gbl...

0 new messages