Skip to content

Instantly share code, notes, and snippets.

@xcud
Last active January 15, 2025 20:20
Show Gist options
  • Save xcud/4683139 to your computer and use it in GitHub Desktop.
Save xcud/4683139 to your computer and use it in GitHub Desktop.
Gets a list of the assemblies loaded into memory in the current AppDomain.
<#
.Synopsis
Gets a list of the assemblies loaded into memory in the current AppDomain.
.Example
PS> Get-Assemblies power -NameOnly
Name
----
Microsoft.PowerShell.ConsoleHost.dll
Microsoft.PowerShell.Security.dll
Microsoft.PowerShell.Commands.Utility.dll
Microsoft.PowerShell.Commands.Management.dll
#>
function Get-Assemblies() {
param($Match, [Switch]$NamesOnly);
$matchingAsms = [Threading.Thread]::GetDomain().GetAssemblies() |
? {$_.Location -match $Match }
if($NamesOnly.IsPresent) {
$matchingAsms | select @{Name="Name"; Expression={ (dir $_.Location).Name }}
}
else {
$matchingAsms
}
}
set-alias asm Get-Assemblies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment