首页 > 解决方案 > 从 powershell 在 HP 交换机上执行命令时出错

问题描述

在进行 SSH 会话(使用 POSH-SSH)后,我正在执行以下命令以针对 HP 交换机创建用户

$Session = New-SSHSession -ComputerName $sHost -Credential $cred
[string]$SystemView = $(Invoke-SSHCommand -SSHSession $Session -Command "system-view").Output
 $SystemView
[string]$CreateUser = $(Invoke-SSHCommand -SSHSession $Session -Command "local-user nocadmin class manage").Output
$CreateUser

我得到的结果

<AAA6HPEDIS00>local-user nocadmin class manage               ^  % Unrecognized command found at '^' position.

当我通过腻子时,它工作正常

在此处输入图像描述

当我检查第一个命令的“$Session”时它是True,但是当它来到第二个命令时,它变成了False

请让我知道是什么问题。

标签: powershell

解决方案


推荐阅读