Then PowerShell is happy, but putting in Invoke-Command, and so on, PowerShell is not happy, and I can not figure out what it wants I found in another post in here that it was expecting a file extension.
So this confuse me a Little.
Keep in mind that the Script Block in Invoke-Command [i]is passed without modification to the remote computer[/i]. So the remote computer is looking at $f1 and $f2 and it has no idea what those are, because those were defined back on your computer.
What you can do inside the script block (v3 and later) is $using:f1 and $using:f2. That will 'copy' $f1 and $f2 from your local scope into the remote scope, so that the remote server knows what they are.