Solved

Script to find other file attributes

Posted on 2008-10-07
1
370 Views
Last Modified: 2011-10-19
I have the following script which I use to find the version of all the dll's and exe's in a directory. I use the re-direct ">" to write it to a text file.

I now have an app that is cross-linking between two vendors and "blowing" it up. What I'd like to do is get not only the version, but the other attributes like Company, internal name and some of the other attributes you see when you right click an exe and look at the version tab.

I want to pull down the list and then from there do an install of the offending app and see what I get afterward.
strComputer = "CompName"
 

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
 

Set colFileList = objWMIService.ExecQuery _

    ("ASSOCIATORS OF {Win32_Directory.Name='C:\MyPath\'} Where " _

        & "ResultClass = CIM_DataFile")
 

For Each objFile In colFileList

    If objFile.Extension = "dll" or  objFile.Extension = "exe"  Then

        Wscript.Echo objFile.Name & " -- " & objFile.Version

    End If

Next

Open in new window

File-Attr.jpg
0
Comment
Question by:Jim P.
1 Comment
 
LVL 38

Accepted Solution

by:
Jim P. earned 0 total points
ID: 22661205
Found it here: http://www.pa-software.com/scripts/?tp=vbs&sc=system
strComputer = "10.65.3.2"
 

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
 

Set colFileList = objWMIService.ExecQuery _

    ("ASSOCIATORS OF {Win32_Directory.Name='C:\Program Files\Sybase\SQL Anywhere 8\win32'} Where " _

        & "ResultClass = CIM_DataFile")
 

For Each objFile In colFileList

    If objFile.Extension = "dll" or  objFile.Extension = "exe"  Then

        strmsg=""

        strmsg = strmsg & "File Name: " & vbTAB & objfile.name & vbCRLF

        strmsg = strmsg & "File Type: " & vbTAB & objfile.filetype & vbCRLF

        strmsg = strmsg & "File Size: " & vbTAB & vbTAB & objfile.filesize & vbCRLF

        strmsg = strmsg & "File Version: " & vbTAB & objfile.version & vbCRLF

        strmsg = strmsg & "Manufacturer: " & vbTAB & objfile.manufacturer & vbCRLF & vbCRLF

        strmsg = strmsg & "Readable: " & vbTAB & objfile.readable & vbCRLF

        strmsg = strmsg & "Writeable: " & vbTAB & objfile.writeable & vbCRLF

        strmsg = strmsg & "Hidden: " & vbTAB & vbTAB & objfile.hidden & vbCRLF

        strmsg = strmsg & "System: " & vbTAB & vbTAB & objfile.system & vbCRLF

        strmsg = strmsg & "Archive: " & vbTAB & vbTAB & objfile.archive & vbCRLF

        strmsg = strmsg & "Encrypted: " & vbTAB & objfile.encrypted & vbCRLF

        strmsg = strmsg & "Compressed: " & vbTAB & objfile.compressed & vbCRLF & vbCRLF & vbCRLF

        strmsg = strmsg & "Created:" & vbTAB & mid(objfile.CreationDate,5,2) & "/" &_

        mid(objfile.CreationDate,7,2) & "/" & mid(objfile.CreationDate,1,4) & vbCRLF

        strmsg = strmsg & "Installed:" & vbTAB & mid(objfile.InstallDate,5,2) & "/" &_

        mid(objfile.InstallDate,7,2) & "/" & mid(objfile.InstallDate,1,4) & vbCRLF

        strmsg = strmsg & "Last Accessed:" & vbTAB & mid(objfile.LastAccessed,5,2) & "/" &_

        mid(objfile.LastAccessed,7,2) & "/" & mid(objfile.LastAccessed,1,4) & vbCRLF

        strmsg = strmsg & "Last Modified:" & vbTAB & mid(objfile.LastModified,5,2) & "/" &_

        mid(objfile.LastModified,7,2) & "/" & mid(objfile.LastModified,1,4) & vbCRLF

        Wscript.Echo strmsg

'        Wscript.Echo objFile.Name & " -- " & objFile.Version

'        Wscript.Echo objFile.Name & " -- " & objFile.Company

'        Wscript.Echo objFile.Name & " -- " & objFile.internal

'        objOutFile.WriteLine(Wscript.Echo objFile.Name & " -- " & objFile.Version)

    End If

Next

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now