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