2010-08-25 24 views
5

我試圖安裝使用PowerShell的一些自定義的Windows服務,我一直無法沒有得到下面的錯誤運行InstallUtil:Invoke-Item cmdlet可以使用參數啓動可執行文件嗎?

A positional parameter cannot be found that accepts argument ''

這裏就是我已經運行,導致上述錯誤:

Invoke-Command -ComputerName <remote machine> -ScriptBlock {Invoke-Item C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe "<path to service exe>"} 

回答

5

從文檔:

The Invoke-Item cmdlet performs the default action on the specified item.

我不相信命令行參數可以用默認的動作中使用。

但是...

在這個例子中,調用項不應該需要調用可執行文件。

Invoke-Command -ComputerName <remote machine> -ScriptBlock { C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe "<path to service exe>"} 
相關問題