powershell or vbscript that lists filenames and versions in \windows\assembly folder?

Westez
Westez used Ask the Experts™
on
I'm asking for a script that will list the filenames and versions including the build number for the files located in the \windows\assembly folder?

Detail: Windows 2003 Standard Server SP2 32bit.

I don't know much about scripting, and I'm in the middle of an upgrade gone bad.

I need a working script.  Sorry for asking to be spoon fed.

TIA
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
hi,
firstly the dll s are not in assembly folder they are in it is subfolders ,for that reason you must search its subfolders with a recursive script that i did in the script below
C:\Windows\assembly>dir
29.10.2010  20:31    <DIR>          GAC
14.07.2009  07:52    <DIR>          GAC_32
29.07.2010  16:46    <DIR>          GAC_MSIL
28.01.2011  01:43    <DIR>          NativeImages_v2.0.50727_32
28.01.2011  01:43    <DIR>          temp
29.10.2010  20:31    <DIR>          tmp
 
Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "C:\windows\assembly"

Set objFolder = objFSO.GetFolder(objStartFolder)

Set colFiles = objFolder.Files
For Each objFile in colFiles
   If InStr(objFile.Name,"dll")> 0 Then
    Wscript.Echo objFile.Name
Wscript.Echo objFSO.GetFileVersion(objFolder.Path&"\"&objFile.Name) 
 
End If


Next
'Wscript.Echo

ShowSubfolders objFSO.GetFolder(objStartFolder)

Sub ShowSubFolders(Folder)
    For Each Subfolder in Folder.SubFolders

        Set objFolder = objFSO.GetFolder(Subfolder.Path)
        Set colFiles = objFolder.Files
        For Each objFile in colFiles
         If InStr(objFile.Name,"dll")> 0 Then
    Wscript.Echo objFile.Name
Wscript.Echo objFSO.GetFileVersion(Subfolder.Path&"\"&objFile.Name) 

End If
        Next
     
        ShowSubFolders Subfolder
    Next
End Sub

Open in new window

Commented:
This is a PowerShell version:
dir C:\Windows\assembly\ -Filter *.dll -Recurse | 
    Select-Object name, @{n="Version";e={$_.versioninfo.productversion}}

Open in new window

Author

Commented:
Guys let me ask for a modifiication.  I'd like to find a given file name. In this case ESRI*.dll.  I want to find all the files that start with ESRI.

El Aristo - I tried plugging in esri*.dll and ESRI*.dll in this line.  They use upper case for the filename, so ESRI is what's in folder.

>>If InStr(objFile.Name,"dll")> 0 Then

Thanks All
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Commented:
PowerShell:
dir C:\Windows\assembly\ -Filter esri*.dll -Recurse |   
    Select-Object name, @{n="Version";e={$_.versioninfo.productversion}}

Open in new window

for a dll like esri you can modify this line like this for upper and lower cases
If InStr(objFile.Name,"esri")> 0  Or InStr(objFile.Name,"ESRI")  Then

or make file name upper
If InStr(UCase(objFile.Name),"ESRI")> 0  Then


Author

Commented:
Guys many thanks both worked and were a big help in solving the problem.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial