WMI to find Downloaded program files

A

Andy Mikkalson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top