Page 1 of 1 1
Topic Options
#209419 - 2014-08-14 01:15 AM preserving hexadecimal results
jadewith Offline
Fresh Scripter

Registered: 2003-06-13
Posts: 45
Loc: Good ole U S of A
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?

Top
#209420 - 2014-08-14 01:29 AM Re: preserving hexadecimal results [Re: jadewith]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
 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

Top
#209421 - 2014-08-14 01:33 AM Re: preserving hexadecimal results [Re: Allen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
Or

 Code:
For Each $piece In $oEltPort.Attributes.PortWWN 
	dectohex($piece) +  ':'	
Next

Top
#209422 - 2014-08-14 01:40 PM Re: preserving hexadecimal results [Re: Allen]
jadewith Offline
Fresh Scripter

Registered: 2003-06-13
Posts: 45
Loc: Good ole U S of A
I swear I tried that!!!!!!

obviously not because it worked perfectly!

Thanks Allen

Top
#209423 - 2014-08-14 02:09 PM Re: preserving hexadecimal results [Re: Allen]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
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
_________________________
Actually I am a Rocket Scientist! \:D

Top
#209424 - 2014-08-16 02:01 AM Re: preserving hexadecimal results [Re: Glenn Barnas]
jadewith Offline
Fresh Scripter

Registered: 2003-06-13
Posts: 45
Loc: Good ole U S of A
Dang it Glenn!!! OK... I'm working on it.
Top
#209427 - 2014-08-16 12:52 PM Re: preserving hexadecimal results [Re: jadewith]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Let us know if you need any help with the UDF.. it would be nice to see some new blood in that forum! \:D
_________________________
Actually I am a Rocket Scientist! \:D

Top
#209430 - 2014-08-18 06:13 AM Re: preserving hexadecimal results [Re: Glenn Barnas]
jadewith Offline
Fresh Scripter

Registered: 2003-06-13
Posts: 45
Loc: Good ole U S of A
OK Glenn, ye ask and ye shall receive!
UDF GetHBAinfo()

Top
#209432 - 2014-08-18 12:39 PM Re: preserving hexadecimal results [Re: jadewith]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Nice - I'll give it a try when I get home tonight..

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#209435 - 2014-08-20 01:30 AM Re: preserving hexadecimal results [Re: Glenn Barnas]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
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

Top
#209438 - 2014-08-20 02:00 AM Re: preserving hexadecimal results [Re: NTDOC]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Doc - we've discussed this offline and Jason is working on an update that will be compliant.. \:D

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#209441 - 2014-08-20 09:04 PM Re: preserving hexadecimal results [Re: Glenn Barnas]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
Great - thanks Glenn
Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (mole) and 405 anonymous users online.
Newest Members
Timothy, Jojo67, MaikSimon, kvn317, kixtarts2025
17874 Registered Users

Generated in 0.067 seconds in which 0.025 seconds were spent on a total of 14 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org