title: Remote register of ocx using powershell
body: <p>I'm trying to register an OCX file on a remote machine using Powershell 2.0.  </p>
  
  <p>This doesn't doesn't work:</p>
  
  <pre><code>$LocalOCXPath = "C:\Windows\SysWOW64\dxapi.ocx"
  Invoke-Command -ComputerName $ComputerName -ScriptBlock { "C:\windows\system32\Regsvr32.exe $args" } -argumentlist $LocalOCXPath
  </code></pre>
  
  <p>But this does:</p>
  
  <pre><code>Invoke-Command -ComputerName $ComputerName -ScriptBlock { &amp; 'regsvr32.exe' 'C:\Windows\SysWOW64\dxapi.ocx' } 
  </code></pre>
  
  <p>I really need to be able to pass the path in via a variable, but I don't think I can do that using option 2.  And I have no idea why option 1 doesn't work.  By doesn't work, I mean that powershell looks like it invokes the command properly, but when I look on the remote machine, the ocx file isn't registered.</p>