Wednesday, November 28, 2012

How to extract metadata or details of a DLL IN GAC using Powershell

Hi,
 Recently I came across an issue to fetch the details of the DLL in GAC Folder.
Detail are like, Name , Version Number and TimeStamp using powershell.

I searched a lot in google and blogs and also in MSDN but didnt found any fruitful result.
Finally after too much to working on this  I finally came up with a simple solution.

Here is the script:



set-variable -option constant -name out -value "dllInventory.csv"
"Name, Version, Time" | Out-File $out -Append



Foreach( $file in Get-ChildItem C:\windows\assembly  -Recurse -filter "*.dll" )
{
if ($file -match "(.*dll)$")
{

 #$temp =  $file.Name, $file.VersionInfo.FileVersion, $file.lastwritetime
     $file.Name + ", " + $file.VersionInfo.FileVersion + ", " + $file.lastwritetime | Out-File $out -append
}
else
{write-host "Not Found"}
}
}
Hope this is help !!

No comments:

Post a Comment