This should be a simple task, but I have seen several attempts on how to get the path to the directory where the executed cmdlet is located with mixed success. For instance,
The reliable way to do this is just like you showed $MyInvocation.MyCommand.Path.
$MyInvocation.MyCommand.Path
Using relative paths will be based on $pwd, in PowerShell, the current directory for an application, or the current working directory for a .NET API.
PowerShell v3+:
Use the automatic variable $PSScriptRoot.
$PSScriptRoot