How would I use a variable containing the resource information for the "Get-ClusterResource" cmdlet?
In other words, the values for all cluster resources to be managed are in a collection variable called $resourceName.
How do I use the information within the collection variable with "Get-ClusterResource" instead of having to manage / type each resource manually?
Get-ClusterResource "disk 1" | Set-ClusterOwnerNode -Owners server1, server2, server3
Get-ClusterResource "disk 2" | Set-ClusterOwnerNode -Owners server1, server2, server3 etc
Instead use
Foreach ($resourceName in $Resources)
{
Get-ClusterResource $resourceName -Cluster ClusterName | Set-ClusterOwnerNode -Owners server1, server2, server3
}
Does not work"
"CannotConvertArgument,Microsoft.FailoverClusters.PowerShell.GetResourceCommand"
Get-ClusterResource : Cannot convert 'Microsoft.PowerShell.Commands.Internal.Format.GroupEndData' to the type 'System.Collections.Specialized.StringCollection' required by
parameter 'Name'. Unable to cast object of type 'System.Management.Automation.PSObject' to type 'System.String'.