I have modified earlier pointed “CreateNFSDatastore” class to work for both VC and ESXi. And also I have written another class “AddNFSDatastoreinESXi” which will work only for ESXi to add the NFS datastore. Please take a look.
CreateNFSDatastore.java à Now it works for both VC/ESXi to add NFS datastore ,
Usage: CreateNFSDatastore url username password hostip/fqdn
Note:: In ESXi case both url & hostip/fqdn ip should be same.
AddNFSDatastoreinESXi.java à It works only for ESXi to add NFS datastore.
Usage: AddNFSDatastoreinESXi hostname username password
Let us know if you need more help.