PC Review Forums Newsgroups Windows XP Windows XP WMI WMI to find Downloaded program files

Reply

WMI to find Downloaded program files

 
Thread Tools Rate Thread
Old 24-08-2004, 02:11 PM   #1
Andy Mikkalson
Guest
 
Posts: n/a
Default WMI to find Downloaded program files


Hello,

I am trying to write a script that will find what controls are in the
windows\Downloaded Program File and puts it in a log file. However when I
run the script to find what is in the directory, the dependencies of the
controls are being displayed instead of the name of the control. Is there a
way to list the controls instead of the dependencies? The controls are what
is displayed in the folder, not the dependencies. Here is what I am using
right now.

Thanks in advance,
Andy Mikkalson

Const ForAppending = 8
set objDictionary = CreateObject("scripting.Dictionary")
Set objOU = Getobject("LDAP://CN=Computers, DC=xxxxxx, DC=com")
objOU.Filter = Array("computer")
For Each objComputer in objOU
objDictionary.Add i, objComputer.CN
i = i + 1
strComputer = objComputer.CN
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\"
& strComputer & "\root\cimv2")
Set objShell = Wscript.CreateObject("Wscript.Shell")
Set objSWbemServices = GetObject("winmgmts:\\" & strComputer)
Set colOperatingSystems =
objSWbemServices.InstancesOf("Win32_OperatingSystem")
For Each objOperatingSystem In colOperatingSystems
strwd = "objOperatingSystem.WindowsDirectory"
if objOperatingSystem.WindowsDirectory = "C:\WINDOWS" then
strOS = "\\windows\\downloaded program files\\"
Else
strOS = "\\winnt\\downloaded program files\\"
End if
Wscript.echo stros
Next
Set colFiles = objWMIService.ExecQuery ("Select * from CIM_DataFile where
Path = '" & strOS & "'")
For Each objfile in colFiles
strFileName = objFile.Name
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\scripts\log.txt", ForAppending)
objFile.Writeline strFileName & " " & now() & " " & strcomputer
objFile.Close
Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\scripts\log.txt", ForAppending)
objFile.WriteBlankLines(1)
objFile.WriteBlankLines(1)
objFile.Close
Next


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off