0
我與都執行這樣的PowerShell腳本工作:如何使用Psconsole.psc1 -Command的Get- {}任何
PS C:\long\path\to\Psconsole.psc1 -Command {Get-whatever...}
他們都產生了錯誤:
You must provide a value expression on the right hand side of the value '-' operator.
*
下面是一個例子:
PS C:\> "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\CONFIG\POWERSHELL\Registration\psconsole.psc1" -Command "Get-Service"
同樣的錯誤信息:
`You must provide a value expression on the right hand side of the value '-' operator.`
... At line 1...
- <<< Command "Get-Service"
+ CategoryInfo: PaserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedError: ExpectedValueExpression
任何人都可以告訴我一種方法來獲得-Command的工作嗎?
該呼叫操作員修復了錯誤。謝謝。現在該命令創建一個PowerShell窗口。但是,它不會執行它中的命令。這可能足以滿足我的需求(需要測試更多),但只是想警告其他讀者。 – dossa22 2014-09-10 22:11:35