PortValhalla/scripts/Common/Scripts/Entrypoints.ps1

14 lines
No EOL
334 B
PowerShell

function Get-Entrypoint() {
$trace = Get-PSCallStack
$call = $trace[$trace.Count - 1];
if ($null -ne $call.ScriptName) {
return $call.ScriptName;
} else {
$call = $CallStack[$CallStack.Count - 2];
return $call.ScriptName;
}
throw "No PowerShell entry point script could be found.";
}