小编mcm*_*ttu的帖子

调用表达式:找不到接受参数 /s 的位置参数

我有一个包含一行的 .ps1 脚本

Invoke-Expression -Command "C:\Builds\$BuildName /s /v`"/l*v c:\build_install.txt /qn`""<br/>
Run Code Online (Sandbox Code Playgroud)

这是执行产品的静默安装。

现在,如果我尝试通过 ssh 从 Linux 机器运行此命令,则会出现以下错误:

Invoke-Expression : A positional parameter cannot be found that accepts argument '/s'.
At line:1 char:1
+ Invoke-Expression C:\NWTBuilds\Setup-NimbleNWT-x64.2.0.4.117.exe /s /v`/l*v c:\n ...
+ CategoryInfo          : InvalidArgument: (:) [Invoke-Expression], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.InvokeExpressionCommand
Run Code Online (Sandbox Code Playgroud)

你对此有什么建议吗?我需要提供任何凭据吗?

所以我也尝试了以下选项:

  1. 通过 ssh 或 telnet 发送命令 powershell.exe -Command ...
  2. 从 ssh 或 telnet 调用 powershell 脚本 powershell.exe -File C:\Sample.ps1

但是,如果我Sample.ps1从 Windows Powershell运行相同的程序,是否完成了静默安装?

ssh powershell installation telnet silent

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

installation ×1

powershell ×1

silent ×1

ssh ×1

telnet ×1