Package as executable in VScode - Detect if running as .exe or as .ps1

Is there a way I can detect in my script if I am running as a packaged PS 7.2 executable of simply running as a PowerShell script?

You could check the process name.

$RunningInPowerShell = (Get-Process -Id $PID).Name -eq 'pwsh'

Awesome, simple and it works. Thank you.

One more question if I may:
My application runs in console mode. Can I suppress the load assembly message:

GAC Version Location

False v4.0.30319 C:\Users\B~1\AppData\Local\\coMgr\7x83XksiwBGAiHpI6dJF

Are you loading the assembly yourself in the script or is this something that’s output after packaging?

I load two UI assemblies:
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
but I don’t get the load messages when running as a script, only when as an .exe.

I think this is something we’ll have to fix. I’ll make sure it gets in the next version.

Ok, thank you.