ucs的Powershell问题

时间:2017-02-20 13:25:47

标签: powershell

以下是我的UCS脚本

Remove-Item F:\Logs\UCS\*
$server= Read-Host -Prompt 'Please enter UCS IP'
$Chasis= '(ChassisId 1)'
connect-UCS $server
Get-UcsTechSupport -PathPattern 'F:\Logs\UCS\${ucs}-techsupp-chassis.tar' -RemoveFromUcs -TimeoutSec 1200 -$Chasis -CimcId all

我尝试运行时遇到错误..

Get-UcsTechSupport : A positional parameter cannot be found that accepts argument '-ChassisId 1'.
At F:\Logs\ucs1.ps1:5 char:1
+ Get-UcsTechSupport -PathPattern 'F:\Logs\UCS\${ucs}-techsupp-chassis.tar' -Remov ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-UcsTechSupport], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Cisco.Ucs.Cmdlets.GetUcsTechSupport

1 个答案:

答案 0 :(得分:0)

你的问题是:

-$Chasis

哪个解析为:

-(ChassisId 1)

特别注意连字符(-

PS将此视为参数的名称

我不知道你正在使用的CmdLet的参数,所以这个更正的代码只是一个例子:

... -TimeoutSec 1200 -ParameterName $Chasis -CimcId all