Back in the day when all we had was VBScript you could run scripts through the command line (cscript) or you would get a more graphical interface (wscript). One of the examples at http://msdn.microsoft.com/en-us/library/aa394599(v=vs.85).aspx shows how to detect running scripts.
I don’t imagine much call for that technique but if you need it – here it is:
Get-CimInstance -ClassName Win32_Process -Filter “Name = ‘cscript.exe’ OR Name = ‘wscript.exe'” |
Format-Table Name, Commandline
You could use a variation to test the command line input to other processes if you need to