如何解决Powershell 输出抑制
我正在尝试使用 psexec + powershell 在远程机器上启用 WinRM,但它给了我一个我无法抑制的不需要的输出。
C:\psexec\PsExec64.exe -nobanner -accepteula \\computer1 powershell.exe Stop-Service winrm
得到了我想要压制的输出:
C:\psexec\PsExec64.exe : Connecting to computer1...
At line:1 char:1
+ C:\psexec\PsExec64.exe -nobanner -accepteula \\computer1 powershell.exe ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Connecting to computer1...:String) [],RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Starting PSEXESVC service on computer1...
Connecting with PsExec service on computer1...
Starting powershell.exe on computer1...
powershell.exe exited on computer1 with error code 0.
我尝试了正常的 powershell 错误处理,但没有奏效。
有什么想法吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。