CmdID

CmdID / PowerShell / Cmdlets / Get

Get-PSCallStack

Displays the current call stack. PowerShell reference

From the PowerShell reference Alias gcs

Opens CmdID with your command, read as PowerShell. It is read in your browser and sent nowhere.

What it does

from the PowerShell reference, CC BY 4.0

Displays the current call stack. The Get-PSCallStack cmdlet displays the current call stack. Although it is designed to be used with the Windows PowerShell debugger, you can use this cmdlet to display the call stack in a script or function outside of the debugger. To run a Get-PSCallStack command while in the debugger, type k or Get-PSCallStack.

Get-PSCallStack [<CommonParameters>]

Get the call stack for a function

PS C:> function My-Alias { $p = $args[0] Get-Alias | where {$_.Definition -like "*$p"} | Format-Table Definition, Name -Auto } PS C:\ps-test> Set-PSBreakpoint -Command My-Alias Command : My-Alias Action : Enabled : True HitCount : 0 Id : 0 Script : prompt PS C:> My-Alias Get-Content Entering debug mode. Use h or ? for help. Hit Command breakpoint on 'prompt:My-Alias' My-Alias Get-Content [DBG]: PS C:\ps-test> s $p = $args[0] DEBUG: Stepped to ': $p = $args[0] ' [DBG]: PS C:\ps-test> s Get-Alias | where {$_.Definition -like "*$p*"} | Format-Table Definition, [DBG]: PS C:\ps-test>Get-PSCallStack Name CommandLineParameters UnboundArguments Location ---- --------------------- ---------------- -------- prompt {} {} prompt My-Alias {} {Get-Content} prompt prompt {} {} prompt PS C:> [DBG]: PS C:\ps-test> o Definition Name ---------- ---- Get-Content gc Get-Content cat Get-Content typeIdentify

Its page in the reference: Get-PSCallStack.