2015-12-07 11:51 PM - edited 2015-12-07 11:56 PM
I am relatively new to PowerShell and the NetApp toolkit (using 4.0, powershell version is 4), but I am writing a script to completely automate a cluster setup for the clusters in my lab with the various settings that I want to have (only after the cluster is created and all nodes have been joined to the cluster). I am currently having issues using the command "Split-NcNetPortBroadcastDomain" from a script or even in the CLI after having defined a variable.Here is the line as I am using it in my script:
Split-NcNetPortBroadcastDomain -Name Default -NewName $NewBroadcastDomain -Port $BroadcastDomainPorts
And here is the error:
Split-NcNetPortBroadcastDomain : Invalid value specified for "ports" element within "net-port-broadcast-domain-split": "node-01:e0d,node-02:e0d". At C:\Tools\clustersetup.ps1:181 char:4 + Split-NcNetPortBroadcastDomain -Name Default -NewName $NewBroadcastDomain -P ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (node.local:NcController) [Split-NcNetPortBroadcastDomain], EINVALIDINP UTERROR + FullyQualifiedErrorId : ApiException,DataONTAP.C.PowerShell.SDK.Cmdlets.Net.SplitNcNetPortBroadcastDomain
Outside of the script I tested the command which works just fine without a variable, but as soon as I use a variable, the command fails. I am able to use the following similar commands with the same variables without issues:
Set-NcNetPortBroadcastDomain -Name Default -RemovePort $BroadcastDomainPorts Set-NcNetPortBroadcastDomain -Name $NewBroadcastDomain -AddPort $BroadcastDomainPorts
Does anyone have any ideas? Just one last bit of info... the variable I am using is 100% for sure a string like the help says is required!
Solved! SEE THE SOLUTION
2015-12-08 02:13 AM
Could you try defining the $BroadcastDomainPorts as an array instead?
$BroadcastDomainPorts = ("node-01:e0d", :node-02:e0d")
I see the man page says the Port parameter should be a String, not a String ... On the CLI a comma seperated string is automatically treated as an array, but not so inside a script. That might be why it's working when executed directly on the CLI but fails inside the script ...
Hope this helps,