Home QuickTipps Bug Bug in PowerShell 3.0: $MyInvocation.MyCommand is Empty
 

Bug in PowerShell 3.0: $MyInvocation.MyCommand is Empty

Many PowerShell scripters use the automatic variable $MyInvocation to find out the current script location. Under certain circumstances, this fails in PowerShell 3.0. Microsoft has confirmed this to be a bug and published a hotfix and a workaround:

http://support.microsoft.com/kb/2830615/en-us