Invoke-Command,Copy-Item, and 'Path is null'

When I just run the command on this server 2012 R2 named: MemberServer:

$f1 = "D:\Scripts\folder1"
$f2 = "D:\Scripts\folder2"
Copy-Item $f1 -Recurse -Destination $f2 -Verbose -Force

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.

$f1 = "D:\Scripts\folder1"
$f2 = "D:\Scripts\folder2"

Invoke-Command -ComputerName MemberServer -ScriptBlock {Copy-Item $f1 -Recurse -Destination $f2 -Verbose -Force}

Cannot bind argument to parameter 'Path' because it is null.
    + CategoryInfo          : InvalidData: [:] [Copy-Item], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.CopyItemCommand
    + PSComputerName        : MemberServer

How can I avoid this in the future?

Thanks for all your help.

Kind regards

Keep in mind that the Script Block in Invoke-Command is passed without modification to the remote computer. 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.

Thank you for the help.

I think I better understand how the invoke-command Works now.