Get-LoadedFunctions.ps1


Description

Purpose

Gets a list of loaded functions based on the specified verb and noun.

Detailed Description

This function retrieves a list of loaded functions based on the specified verb and noun. If no verb or noun is specified, all loaded functions are returned.

Back to Top

Usage

Example 1

Get-LoadedFunctions -Verb Get -Noun Item

This command retrieves a list of loaded functions that have “Get” as the verb and “Item” as the noun.

Example 2

Get-LoadedFunctions -Wide

This command retrieves a list of all loaded functions and displays the output in a wide format.

Back to Top

Notes

No additional notes.

Back to Top


Script

function Get-LoadedFunctions {
    <#
    .SYNOPSIS
        Gets a list of loaded functions based on the specified verb and noun.
    
    .DESCRIPTION
        This function retrieves a list of loaded functions based on the specified verb and noun. If no verb or noun is specified, all loaded functions are returned.
    
    .PARAMETER Verb
        Specifies the verb to filter the loaded functions by. Wildcards are supported.
    
    .PARAMETER Noun
        Specifies the noun to filter the loaded functions by. Wildcards are supported.
    
    .PARAMETER Wide
        If specified, the output is displayed in a wide format.
    
    .EXAMPLE
        Get-LoadedFunctions -Verb Get -Noun Item
    
        This command retrieves a list of loaded functions that have "Get" as the verb and "Item" as the noun.
    
    .EXAMPLE
        Get-LoadedFunctions -Wide
    
        This command retrieves a list of all loaded functions and displays the output in a wide format.
    #>
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $false)]
        [string]$Verb = "*",
        [Parameter(Mandatory = $false)]
        [string]$Noun = "*",
        [Parameter(Mandatory = $false)]
        [switch]$Wide
    )

    $funcs = Get-Command -CommandType Function | Where-Object -FilterScript { ( $_.Source -eq '' ) -and ( $_.Name -like '*-*' ) } | Select-Object -Property Name

    if ($Verb -ne "*") {
        $funcs = $funcs | Where-Object { $_.Name -like "$Verb-*" }
    }

    if ($Noun -ne "*") {
        $funcs = $funcs | Where-Object { $_.Name -like "*-$Noun" }
    }

    if ($Wide) {
        $funcs | Format-Wide -Autosize
    }
    else {
        return $funcs
    }
}

Back to Top

Download

Please feel free to copy parts of the script or if you would like to download the entire script, simply click the download button. You can download the complete repository in a zip file by clicking the Download link in the menu bar on the left hand side of the page.


Report Issues

You can report an issue or contribute to this site on GitHub. Simply click the button below and add any relevant notes. I will attempt to respond to all issues as soon as possible.

Issue


Back to Top