function Get-GrandParentFunctionName { <# .SYNOPSIS Get the name of the function that called the one that called us #> [CmdletBinding()] [OutputType([System.String])] Param() return (Get-PSCallStack)[2].Command }