Note: PowerShell 1.0 I\'d like to get the current executing PowerShell file name. That is, if I start my session like this:
powershell.exe .\\myfile.ps
This can works on most powershell versions:
(& { $MyInvocation.ScriptName; })
This can work for Scheduled Job
Get-ScheduledJob |? Name -Match 'JOBNAMETAG' |% Command