That is in fact a function, so you will have to first dot-source the .ps1 file.
PS C:> . ./Test-InvokeVMScript.ps1
Note that there is a blank between the 2 dots.
Once that is done your PowerShell engine "knows" the function.
And you can do
$vm
= Get
-VM
-Name
2008t1
Test
-InvokeVMScript
-VM
$vm
-Detail