Some time ago, I had a need to look up an assembly in the GAC or some such operation—can’t remember exactly what I needed to do—but was surprised to find no easy way to use a Visual Studio command line utility or even PowerShell to do the work I needed. Well, a few days ago, I come across this post on how to produce a list of all assemblies in the GAC. Sweet. However, let’s do a little more tinkering.
First, let’s use the windir environment variable so I can make my script a little more portable across OSes. Second, let’s go ahead and pipe the output to System.Reflection and go ahead and get something nice—like, say, the fully-qualified name of each assembly. Now we’re talking!
Get-ChildItem $env:windir\assembly\GAC_MSIL -filter *.dll -recurse | %{[System.Reflection.Assembly]::LoadFile($_.FullName).FullName}
|