title: PowerShell Splatting the Argumentlist on Invoke-Command
body: <p>How is it possible to use the parameters collected in a hash table for use with <code>ArgumentList</code> on <code>Invoke-Command</code>?</p>
  
  <pre><code>$CopyParams = @{
      Source      = 'E:\DEPARTMENTS\CBR\SHARE\Target'
      Destination = 'E:\DEPARTMENTS\CBR\SHARE\Target 2'
      Structure   = 'yyyy-MM-dd'
  }
  Invoke-Command -Credential $Cred -ComputerName 'SERVER' -ScriptBlock ${Function:Copy-FilesHC} -ArgumentList @CopyParams
  </code></pre>
  
  <p>Whatever I try, it's always complaining about the 'Source':</p>
  
  <pre><code>Cannot validate argument on parameter 'Source'. The "Test-Path $_" validation script for the argument with
   value "System.Collections.Hashtable" did not return true. Determine why the validation script failed
  </code></pre>
  
  <p>This <a href="http://jdhitsolutions.com/blog/tag/splatting/" rel="noreferrer">blog</a> talks about a similar problem, but I can't get it to work.</p>
  
  <p>The same is true for a simple <code>Copy-Item</code> within <code>Invoke-Command</code>, example:</p>
  
  <pre><code>Invoke-Command -Credential $Cred -ComputerName 'SERVER' -ScriptBlock {Copy-Item} -ArgumentList @CopyParams
  
  Invoke-Command : Missing an argument for parameter 'ArgumentList'. Specify a parameter of type 'System.Obj
  ect[]' and try again.
  At line:11 char:89
  + ... ck {Copy-Item} -ArgumentList @CopyParams
  </code></pre>
  
  <p>Thank you for your help.</p>