Step 1: Choose a server where you can access all your LPAR’s
Step 2: Generate a key from the chosen server and then scp same key to LPAR under /root
Step 3: Now, You can execute the below script from chosen server

Note:- In our case, We have chosen NIM server as our source server where the script to be executed
server – Should contain LPAR or server name
Name of the script: lpar_wwpn_number.sh

echo Server Name,FCS,WWPN,Location Code

CSV=","

for lpar_wwpn_number_list in `cat server`
do
for FCSX in `ssh $lpar_wwpn_number_list lscfg | grep fcs | awk '{ print $2 }'`
do
echo $lpar_wwpn_number_list${CSV}${FCSX}${CSV}`ssh $lpar_wwpn_number_list lscfg -vl ${FCSX} | grep "Network Address" | sed -e "s/^.*\.//" | sed 's/../&:/g;s/:$//'`${CSV}`ssh $lpar_wwpn_number_list lscfg -l ${FCSX} | awk '{ print $2 }'`
done
done