Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我如何使用PowerShell停止和启动群集的;通用服务;?_Powershell - Fatal编程技术网

我如何使用PowerShell停止和启动群集的;通用服务;?

我如何使用PowerShell停止和启动群集的;通用服务;?,powershell,Powershell,如何使用PowerShell停止和启动Microsoft“Cluster Administrator”软件中的“通用服务”?答案是只需使用命令行工具Cluster.EXE即可: 群集资源MyGenericServiceName/OFF cluster RES MyGenericServiceName/ON您也可以使用WMI。您可以通过以下方式获得所有通用服务: $services = Get-WmiObject -Computer "Computer" -namespace 'root\mscl

如何使用PowerShell停止和启动Microsoft“Cluster Administrator”软件中的“通用服务”?

答案是只需使用命令行工具Cluster.EXE即可:

群集资源MyGenericServiceName/OFF


cluster RES MyGenericServiceName/ON

您也可以使用WMI。您可以通过以下方式获得所有通用服务:

$services = Get-WmiObject -Computer "Computer" -namespace 'root\mscluster' `
MSCluster_Resource | Where {$_.Type -eq "Generic Service"}
要停止和启动服务,请执行以下操作:

$timeout = 15
$services[0].TakeOffline($timeout)
$services[0].BringOnline($timeout)

太好了…但在执行时我遇到了一些管理错误。因此,我添加了这个参数
-authenticationpacketprivacy
,它起了作用。谢谢