Per my other thread I can now get a list of groups that my host is a member of but when I try my workflow to adding it back, my task errors out with: A specified parameter was not correct.
This is the code I'm using (adapted from powercli that was captured in vcenter) where:
myHost = VC:HostSystem
hostGroupName = string
var spec = new VcClusterConfigSpecEx(); var myArrayOfHosts = new Array(); myArrayOfHosts[0] = new VcHostSystem(); myArrayOfHosts[0] = myHost; var myVcClusterHostGroup = new VcClusterHostGroup(); myVcClusterHostGroup.host = myArrayOfHosts; myVcClusterHostGroup.name = hostGroupName; myVcClusterHostGroup.userCreated = true; var myVcClusterGroupSpec = new Array() myVcClusterGroupSpec[0] = new VcClusterGroupSpec(); myVcClusterGroupSpec[0].operation = VcArrayUpdateOperation.add; myVcClusterGroupSpec[0].info = new VcClusterHostGroup(); myVcClusterGroupSpec[0].info = myVcClusterHostGroup; spec.groupSpec = myVcClusterGroupSpec; spec.drsConfig = new VcClusterDrsConfigInfo(); myTask = myHost.parent.reconfigureComputeResource_Task(spec,true)
At one point I managed to get the task to go through (don't figure out what i changed anymore) but it didn't actually add the host to the group.
Any ideas as to the problem?