#SharePointProblems | Koskila.net

Solutions are worthless unless shared! Antti K. Koskela's Personal Professional Blog
>

Listing all of the assemblies loaded in a PowerShell session?

koskila
Reading Time 2 min
Word Count 241 words
Comments 2 comments
Rating 5 (5 votes)
View

In this article, I'll do my best to explain how to list all loaded assemblies in a PowerShell session. You see, PowerShell is great at caching assemblies in the weirdest possible way, so ending up with all kinds of mismatches in loaded DLL versions is pretty common. Or just being plainly blocked from loading a new one as you already have a cached reference. I mean, I've run into all kinds of issues even if I only use PowerShell occasionally.

Maybe that's the reason.

Anyhow, below, I'll share a script that will list all of the currently loaded assemblies.

Solution

Table of Contents

Let's keep this short and sweet.

Time needed: 2 minutes.

How to list all of the assemblies loaded in a PowerShell session?

  1. Fire up PowerShell (PS 5+ should work just fine)

  2. Run the script in PowerShell

    The script below will select all assemblies that are currently loaded, select the ones with a defined location, and display their name, location, and statuses of GAC deployment and full trust in a GridView.

    [System.AppDomain]::CurrentDomain.GetAssemblies() | Where-Object Location | Sort-Object -Property FullName | Select-Object -Property FullName, Location, GlobalAssemblyCache, IsFullyTrusted | Out-GridView

  3. Observe the output!

    You should get an output somewhat like this:

    Output from CurrentDomain.GetAssemblies() formatted nicely in a Out-GridView
    Output from CurrentDomain.GetAssemblies() formatted nicely in an Out-GridView

    You should see all of the assemblies PowerShell has in memory!

And there you go!


Did this work for you? Not what you wanted? Let me know in the comments -section below!

References

Comments

Interactive comments not implemented yet. Showing legacy comments migrated from WordPress.
2021-03-31 20:37:59)
Wow, thank you for this! This was the only article that helped me fix my issue. My dll was being bundled with the incorrect assembly version, but being able to see the list of loaded assemblies made it immediately clear what was wrong. Thanks again!
Antti K. Koskela
2021-04-04 23:20:27
Thanks, Zeb - happy to be of help!