PowerShell hosts may be launched with arguments, i.e. you may run powershell.exe or pwsh.exe with arguments like –NoProfile, or submit paths to scripts to execute.
From within the shell, you can always view the command that launched this shell, including additional arguments:
$exe, $parameters = [System.Environment]::GetCommandLineArgs() "EXE: $exe" "Args: $parameters"
When you launch powershell.exe with „-NoProfile“, the results looks like this:
EXE: C:\WINDOWS\system32\WindowsPowerShell\v1.0\PowerShell.exe Args: -noprofile
When you submit more than one argument, then $parameters is an array.