E-Series, SANtricity and Related Plug-ins Discussions

Highlighted

Creating new host with powershell

Hi,

 

I am trying to copy the hosts I have in an E2860 to a new E5760.

I have extracted the information using get-nehost but am struggling with the format for the

new-nehost command

I get this error whether I use a variable or manually specify the value

new-nehost -Credential $NECred4 -SystemId 1 -name $name.name -Ports "20000025B50B003C" -HostType VmwTPGSALUA

New-NeHost : Cannot bind parameter 'Ports'. Cannot convert the "20000025B50B003C" value of type "System.String" to type "NetApp.PowerShell.TO.HostPortCreateRequest"

 

I get the same issue with hosttype.

The help page refers to the option as

 

-Ports [<List<HostPortCreateRequest>>]

 

But I have not found a way of doing this.

 

Has anyone done this and could give me an example of the correct syntax.

1 REPLY 1
Highlighted

Re: Creating new host with powershell

After checking with some folks, you would need to create the correct object type and pass that in as the argument for the -Ports parameter. Here's an example:

 

$hostport = New-object -TypeName NetApp.Powershell.TO.HostPortCreateRequest # Use this as the argument

$hostport | Get-Member # to see the list of members that you can set

$hostport.Port = “WWPN” # 20000025B50B003C

 

Do the same for the host type if the it is looking for the same object type.

 

 

Check out the KB!
NetApp Insights To Action
All Community Forums