2024-03-16 00:04:56 +00:00
|
|
|
function Get-Entrypoint() {
|
2024-03-20 23:29:38 +00:00
|
|
|
$trace = Get-PSCallStack
|
|
|
|
$call = $trace[$trace.Count - 1];
|
2024-03-16 00:04:56 +00:00
|
|
|
|
|
|
|
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.";
|
|
|
|
}
|