title: Powershell passing arguments in ScriptBlock
body: <p>I'm trying to get the last write time on a file from a remote server.</p>
  
  <p>This doesn not work:</p>
  
  <pre><code>$server = "MyServerName"
  
  $lastWrite = Invoke-Command -Computername $server -ScriptBlock {Get-ChildItem "\\$args[0]\hot.war" } -argumentlist $server | select -Property LastWriteTime
  </code></pre>
  
  <p>This does work:</p>
  
  <pre><code> $lastWrite = Invoke-Command -Computername $server -ScriptBlock {Get-ChildItem "\\MyServerName\hot.war" } -argumentlist $server | select -Property LastWriteTime
  </code></pre>
  
  <p>Can anyone help make the first set work?</p>