2

https://docs.microsoft.com/en-us/powershell/module/failoverclusters/set-clusterparameter?view=windowsserver2016-ps

Microsoft (and others) have good documentation on this but it's not working for me. I am trying to set the IP address parameters. The issue is that the IP address is not part of the allowable object types to modify.

For example this fails (from MS docs)

PS C:\> Get-ClusterResource -Name "Cluster IP Address" | Set-ClusterParameter -Multiple @{"Address"="172.24.22.168";"Network"="Cluster Network 2";"EnableDhcp"=1}

The IP address of the cluster is "Cluster IP Address". I can see it. GetType() is PSObject. But when I run teh Set-ClusterParameter command the error is:

Set-ClusterParameter: The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.

If I try to use the object.

PS C:\Users\rdejournett> Set-ClusterParameter -InputObject

$SqlIpAddress Set-ClusterParameter: Cannot bind parameter 'InputObject' to the target. Exception setting "InputObject": "Invalid object in the pipeline. This cmdlet only accepts objects of the following types: Microsoft.FailoverClusters.PowerShell.Cluster,Microsoft.FailoverClusters.PowerShell.ClusterGroup,Microsoft.FailoverClusters.PowerShell.ClusterResource,Microsoft.FailoverClusters.PowerShell.ClusterResourceType,Microsoft.FailoverClusters.PowerShell.ClusterNetwork,Microsoft.FailoverClusters.PowerShell.ClusterNetworkInterface,Microsoft.FailoverClusters.PowerShell.ClusterNode,Microsoft.FailoverClusters.PowerShell.ClusterSharedVolume,Microsoft.FailoverClusters.PowerShell.ClusterParameter"

(The object is being set like this)

$SqlIpAddress = Get-ClusterResource | Where-Object {$_.Name.StartsWith("Cluster IP Address")}

It appears that the IP address resource is not a type of resource that can be set, despite the documentation (or I am doing something wrong...)

Rob
  • 163

1 Answers1

3

This was a doozy. The MS Documentation was leading to really strange results.

The answer is that I was using the wrong version of powershell. Do not use Powershell 7. Use the powershell version that comes native with windows.

This command should work:

PS C:\Users\rdejournett> $t = Get-ClusterGroup -Name "Cluster Group"
PS C:\Users\rdejournett> $t.GetType()

And the resultant object type should be

IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     False    ClusterGroup                             Microsoft.FailoverClusters.PowerShell.ClusterObject

In powershell 7 the BaseType is psobject - basically what it is doing is its storing EVERYTHING as an base object (related to cluster groups), so none of the piping works properly.

Rob
  • 163