powershell - 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 错误处理,但没有奏效。
有任何想法吗?
解决方案
推荐阅读
- networking - IPv4 网络 ID 和主机 ID
- android - 包 IInAppBillingService 不存在
- html - 当我使用 h-100 类时,内容在容器外(在移动设备上)中断
- java - 如何在 Fedora 28 中为 Docker 安装 Tomcat 容器?
- sql - 为什么“变异表错误”是运行时?
- python - 使用 celery 时,SQLAlchmey 经常遇到数据库连接问题
- ruby - 如何使用 graphql-ruby 测试 GraphQL 模式?
- c# - 传递类实例后变量不更新
- python - 在 python-pptx 中更改系列填充颜色
- android - 检测到不一致。无效的视图持有者适配器 positionViewHolder... android.support.v7.widget.RecyclerView