|
|
|||||||
Hey guys, I am trying to pull the fiber channel information from a server and have run into a wall. I can get all the information, however the pwwn's don't display correctly when printed. here's my code: Code: $servername='mysserver' $oWbemServices = GetObject("winmgmts://$servername/root/wmi") $enumSetAdapters = $oWbemServices.InstancesOf("MSFC_FCAdapterHBAAttributes") $enumSetPorts = $oWbemServices.InstancesOf("MSFC_FibrePortHBAAttributes") $nIndex = 0 For Each $oEltAdapter In $enumSetAdapters For Each $oEltPort In $enumSetPorts If ($oEltAdapter.InstanceName = $oEltPort.InstanceName) " Model: " + $oEltAdapter.Model ? " HardwareVersion: " + $oEltAdapter.HardwareVersion ? " DriverVersion: " + $oEltAdapter.DriverVersion ? " Status: " + $oEltAdapter.HBAStatus ? " node_wwn: " For Each $piece In $oEltAdapter.NodeWWN $piece ':' Next ? " port_wwn: " For Each $piece In $oEltPort.Attributes.PortWWN $piece ':' Next ? $nIndex = $nIndex + 1 EndIf Next ' $oEltPort' Next ' $oEltAdapter' the results of the piece that I want comes out like so: port_wwn: 33:0:0:36:255:91:208:99: which is the decimal equivalent of the hexadecimal value that I want: 21:00:00:24:ff:5b:d0:62 How do I make it display correctly? |
||||||||
|
|
|||||||
Code: $num=split("33:0:0:36:255:91:208:99",":") for $i=0 to ubound($num) $num[$i]=dectohex($num[$i]) next $hex=join($num,":") ? $hex |
||||||||
|
|
|||||||
Or Code: For Each $piece In $oEltPort.Attributes.PortWWN dectohex($piece) + ':' Next |
||||||||
|
|
|||||||
I swear I tried that!!!!!! obviously not because it worked perfectly! Thanks Allen |
||||||||
|
|
|||||||
Jadewith, I can see a use for this.. I better find a GetFcHBA() UDF posted in the UDFs section in the next couple of days! Just return an array instead of displaying the data. Glenn |
||||||||
|
|
|||||||
Dang it Glenn!!! OK... I'm working on it. |
||||||||
|
|
|||||||
Let us know if you need any help with the UDF.. it would be nice to see some new blood in that forum! |
||||||||
|
|
|||||||
OK Glenn, ye ask and ye shall receive! UDF GetHBAinfo() |
||||||||
|
|
|||||||
Nice - I'll give it a try when I get home tonight.. Glenn |
||||||||
|
|
|||||||
Thank you for the UDF and input. As it would appear the current version does not fully comply with UDF standards please review the suggestions and either update the UDF or let us know and we can move it to the Scripting forum until it is ready. Thanks again |
||||||||
|
|
|||||||
Doc - we've discussed this offline and Jason is working on an update that will be compliant.. Glenn |
||||||||
|
|
|||||||
Great - thanks Glenn |