Gary
------------------------------------------
Gary Paquette
http://msdn.microsoft.com/library/en-us/script56/html/jsobjfilesystem.asp
"Gary Paquette" <gpaq...@incontroltechnology.com> wrote in message
news:uz1IiXOC...@TK2MSFTNGP10.phx.gbl...
> 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
------------------------------------------
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
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...