分页: 1 / 1

3PAR – Automation/Part III: Collecting WWN of targets

发表于 : 2012年 5月 1日 21:33 星期二
admin
3PAR – Automation/Part III: Collecting WWN of targets

Author Dung Hoang Khac

So the next task of this automation is to collect WWNs of 3PAR controller ports. As 3PAR provides a CLI interface and SSH, I leverage the same plink/putty tool used in the first part to connect to a 3PAR controller.

to get a list of WWNs of the ports, you issue the command showport –par

and the PowerShell command line is extremely simple ( using run-plink function defined in PART II)

run-plink –username 3paradm –password 3pardata –chassis 10.0.1.11 –cmd “showport” > c:\3PAR.txt

## Remove extra spaces

(type c:\3PAR.txt) -replace "\s+",";" | out-file c:\3PAR.txt

## Remove ‘-‘ character and ‘_’ character

(type c:\3PAR.txt) -replace "-+","" | out-file c:\3PAR.txt

(type c:\3PAR.txt) -replace "_","" | out-file c:\3PAR.txt

# Finally reformat the header

(type c:\3PAR.txt) -replace "/HWAddr","" | out-file c:\3PAR.txt

image29.png
Now I can create a CSV file

$a = import-csv –path c:\3PAR.txt
$a | out-gridview

image30.png
Collect-3PARTargets.zip