14 lines
349 B
PowerShell
14 lines
349 B
PowerShell
|
function Get-Entrypoint() {
|
||
|
$stackTrace = Get-PSCallStack
|
||
|
$call = $stackTrace[$stackTrace.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.";
|
||
|
}
|