views:

84

answers:

1

How to compare the 64bit systems GAC using powershell?

Parameters: Assembly name full name version

+2  A: 

Not sure exactly what you're after but if it is to compare 32-bit and 64-bit GAC'd assemblies try something like this:

PS> $gac64 = gci C:\Windows\assembly\GAC_64 -r *.dll | 
    select @{n='AQN';e={"$($_), $((Split-Path $_.PSParentPath -leaf) -split '__' -join ', ')"}} | 
    Sort AQN
PS> $gac32 = gci C:\Windows\assembly\GAC_32 -r *.dll | 
    select @{n='AQN';e={"$($_), $((Split-Path $_.PSParentPath -leaf) -split '__' -join ', ')"}} | 
    Sort AQN

PS> diff $gac32 $gac64 -Property AQN

AQN                                                         SideIndicator
---                                                         -------------
Mcx2Dvcs.dll, 6.1.0.0, 31bf3856ad364e35                     =>
Microsoft.MediaCenter.Interop.dll, 6.1.0.0, 31bf3856ad36... =>
Microsoft.MediaCenter.iTV.Media.dll, 6.1.0.0, 31bf3856ad... =>
Microsoft.MediaCenter.Mheg.dll, 6.1.0.0, 31bf3856ad364e35   =>
Microsoft.MediaCenter.Playback.dll, 6.1.0.0, 31bf3856ad3... =>
Microsoft.MediaCenter.TV.Tuners.Interop.dll, 6.1.0.0, 31... =>
Microsoft-Windows-HomeGroupDiagnostic.NetListMgr.Interop... =>
SoapSudsCode.dll, 2.0.0.0, b03f5f7f11d50a3a                 =>
Expression.DevHost.dll, 3.0.0.4000, 31bf3856ad364e35        <=
Expression.DevHost.resources.dll, 3.0.0.4000_en_31bf3856... <=
Microsoft.Expression.Encoder.Api2.dll, 3.0.0.0, 31bf3856... <=
Microsoft.Expression.Encoder.dll, 3.0.0.0, 31bf3856ad364e35 <=

Note that the splitting isn't foolproof (pretty naive impl) but it should be sufficient to compare what's different between 32-bit and 64-bit GAC.

Keith Hill
Thanks for your help.Can you please elaborate the command line?$gac64 = gci C:\Windows\assembly\GAC_64 -r *.dll | select @{n='AQN';e={"$($_), $((Split-Path $_.PSParentPath -leaf) -split '__' -join ', ')"}} | Sort AQN so that i can customize as per my requirement.
CrazyNick
gci path -r *.dll gets all the dlls located at path recursively. The select (select-object) cmdlet, can project the incoming object (a Syste.IO.FileInfo) to another object (PSCustomObject) by taking various properties from FileInfo, manipulating those properties in a single property called AQN. Select-Object accepts a hashtable to define this project where the Name entry ('n' for short) defines the property name and the Expression entry ('e' for short) defines the value of the property.
Keith Hill