Microsoft Virtualization Discussions

Problem using Split-NcNetPortBroadcastDomain from a script

dhepler
4,580 Views

Hi All,

 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!

 

Thanks,

David

 

1 ACCEPTED SOLUTION

Aparajita
4,565 Views

Hi David,

 

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,

Aparajita

 

 

View solution in original post

3 REPLIES 3

Aparajita
4,566 Views

Hi David,

 

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,

Aparajita

 

 

dhepler
4,563 Views

I think you may be right. I will test a bit more and let you know. Strange that the other commands did not have a problem but this one did. Thanks!

dhepler
4,548 Views

So, after re-writing that part of my script a bit I tested using an array instead of just a [string] and it worked! Thank you!

Public