So, I wrote a script to get the WWN's of a cluster but it requires manual input and can only get per cluster. If I wanted to allow it to do something like this:
Get-Datacenter | Get-WWN
First, does it need to be a function can I pass to a script? Second what would I put as a parameter to be able to take that pipeline?
#Set mandatory parameters for cluster and csvnameparam ( [Parameter(Mandatory=$true)][string]$Cluster, )#Get cluster and all host HBA information and change format from Binary to hex$list=Get-cluster$cluster | Get-VMhost | Get-VMHostHBA-TypeFibreChannel | Select VMHost,Device,@{N="WWN";E={"{0:X}"-f$_.PortWorldWideName}} | Sort VMhost,Device#Go through each row and put : between every 2 digitsforeach ($itemin$list){ $item.wwn = (&{for ($i=0;$i-lt$item.wwn.length;$i+=2) { $item.wwn.substring($i,2) }}) -join':' }#Output CSV to current directory.$list | export-csv-NoTypeInformation WWN.csv