Get-ExtensionMethod.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function Get-ExtensionMethod
{
    <#
    .Synopsis
        Gets loaded extension methods
    .Description
        Gets the currently loaded extension methods
    .Example
        Get-ExtensionMethod
    .Link
        Get-Type
    #>

    param()
    [AppDomain]::CurrentDomain.GetAssemblies() |
        ForEach-Object {
            $_.GetTypes()
        } | 
        Where-Object {
            $_.IsPublic -and $_.IsAbstract -and $_.IsSealed -and (-not $_.GetConstructors())
        } |
        ForEach-Object {
            $_.GetMethods("Public, Static")
        } |
        Where-Object {
            $_.GetParameters().Count -ge 1
        }
        
}