Adding a generic service to cluster from powershell

十年热恋 提交于 2019-12-21 21:14:00

问题


I'm a newbie in clustering and I'm trying to create a generic service to a cluster using PowerShell. I can add it without any issues using the GUI, but for some reason I cannot add it from PowerShell.

Following the first example from the documentation for Add-ClusterGenericServiceRole, I've tried the following command:

Add-ClusterGenericServiceRole -ServiceName "MyService"

This throws the following error:

Static network was [network range] was not configured. Please use -StaticAddress to use this network or -IgnoreNetwork to ignore it. 

What's the connection between the network and my service? And why aren't these details required when creating it from the GUI?

I also tried another approach, creating the resource with:

Add-ClusterResrouce -Name MyService -ResourceType "Generic Serice"

This command succeeded but I noticed in the GUI that the ServiceName is blank, and thus the actual service cannot be started. If I could somehow change the ServiceName property it should do the trick. Again, from PowerShell I tried the following:

$resource = Get-ClusterResrouce "MyService"
$Resource.ServiceName = "Actual name of service" //property ServiceName cannot be found on this object.

I've been struggling for a couple of hours now with no luck. Is there something basic I'm missing? I think this shouldn't be as complicated as it might look.


回答1:


I had the same problem; I had to add a large amount of services and got stuck with the "ServiceName" as well.

First, a note on the Add-ClusterGenericServiceRole command: this is for creating the service resource and the role at the same time, as opposed to just adding the service resource to an existing role.

Now, the solution is that you have to set the parameter "ServiceName" with the Set-ClusterParameter command. You can do this for an existing service resource like this:

Get-ClusterResource "ServiceDisplayName" | Set-ClusterParameter -Name ServiceName -Value "ServiceName"

However, you probably want to create the resource with everything it needs in one go, like this:

Add-ClusterResource -Name "ServiceDisplayName" -Group "cluster role" -ResourceType "Generic Service" | Set-
ClusterParameter -Name ServiceName -Value "ServiceName"


来源:https://stackoverflow.com/questions/29198880/adding-a-generic-service-to-cluster-from-powershell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!