首页 > 解决方案 > 重新启动 WinRM 服务

问题描述

我试图在多台服务器上重新启动 winRM 服务,但是我得到了以下错误我可以得到建议。

Restart-Service -ComputerName (Get-Content G:\12282019\Servers.txt) -ServiceName WinRM

错误:

重新启动服务:找不到与参数名称“计算机名称”匹配的参数。在 line:1 char:17 + restart-service -ComputerName (Get-Content G:\12282019\Servers.txt) - ... + ~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: ( :) [Restart-Service], ParameterBindingException + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.RestartServiceCommand

标签: windowspowershellwin32serviceutil

解决方案


Restart-Service没有ComputerName参数 - 有关 Microsoft 文档,请参见此处。最简单的选择是:

Get-Service -ComputerName HOST_NAME -Name WinRM | Restart-Service

这是一篇更深入的文章


推荐阅读