Skip to content

Instantly share code, notes, and snippets.

@xcud
Last active February 8, 2024 11:37
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