Unsolved

This post is more than 5 years old

50 Posts

11873

November 21st, 2011 11:00

Powershell - New-SCServerPort and WWNs

This post has been copied from the former Compellent User Forum and placed here for your reference.  This code is made available AS IS, without warranty of any kind.  The entire risk of the use or the results from the use of this code remains with the user.

New-SCServerPort and WWNs – Originally posted By njcwotx, 05 Aug 2009

njcwotx -I started up with SC powershell today, I just added a new ESX server and used this command:

New-SCServer -Name hostname4 -IPAddress 1.2.3.4 -iSCSIAddress 1.2.3.4

and it adds the server.  I wonder though, how can I get the script to find the WWN of the esx host then add it?  Right now it looks like I have to manually look them up and type them in to add them through powershell.  Im sure there is a way to pull them.

PS. anyone have any nice sample scripts for vmware esx that basically do these things:

add a new esx host to compellent, setup the fc and iscsi ports, map a list of volumes (or all of them), or any other useful ones.  I also use vitoolkit, and have a little more experience with that but examples doing the kinds of things I need to do help me learn the commands faster.

Compellent - Hey Njcwotx

Welcome to the forums. If you're really digging into PowerShell, you should join our user group and swap scripts with the other 130 users. Find us at:

http://compellentpowershell.groups.live.com/

njcwotx - I did manage to find a way to script getting the wwn through hex using vi toolkit.

______________________________________________________

$report = @()

foreach ($esx in get-cluster | get-vmhost | get-view | sort-object name){

 foreach($hba in $esx.Config.StorageDevice.HostBusAdapter){

   $row = "" | select Name,WWN

   $row.Name = $esx.name

  if($hba.GetType().Name -eq "HostFibreChannelHba"){

   $wwn = $hba.PortWorldWideName

   $wwnhex = "{0:x}" -f $wwn

   $row.WWN = $wwnhex

   $report += $row

   }

 }

}

echo "end"

echo $report

______________________________________________________

I also integrated the compellent snapin to the VI environment to link the cmdlets in one shell so I can scrape out wwns and use them to make one larger script that should 1.  Add the new host to compellent, hba's and map volumes.  Its still a work in progress, but here is the command so that VI toolkit and Compellent shells merge.

I added this to the bottom just above the signature section "C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-VIToolkitEnvironment.ps1" script that starts the vi toolkit.

Add-PSSnapin -name Compellent.StorageCenter.Scripting

Compellent - Thanks for sharing that with the community. We appreciate it!

TMFHQI - Compellent-

Regarding the Live group http://compellentpowershell.groups.live.com/

We applied for group membership a few days ago but have not yet gotten a reply.  How often are new membership requests addressed?  We'd really like to start digging into PowerShell with regards to our new CML devices.

TMF

TMFHQI - UPDATE:  My application to join the "Live" group was accepted back on May 26.  Thanks to whoever is managing the "Live" group membership!

No Responses!
No Events found!

Top