Using ESXCLI to add multiple Static iSCSI Targets @ Once

Use Notepadd ++ for this.

Also set it to UNIX system

Now use the following commandline to add multiple iSCSI targets (one by once)

esxcli iscsi adapter discovery statictarget add -A <vmbhaXX> -a <ip adress>:3260 -n <IQN name of Target>

End the script with rescanning all storage like this

esxcli storage core adapter rescan --all

Now save the file and upload it to the esxi /tmp folder using something like WinSCP

Now from the ESXi CLI make the file executable by doing this

chmod 755 <filename>

now run your script using


Wait for the script to finish