Can you give a try with this API: https://www.vmware.com/support/developer/converter-sdk/conv50_apireference/vim.host.DatastoreSystem....
Here is sample script in perl for this: How to add NFS share as datastore to ESX/ESXi host using Perl SDK .. ? You can refer this and code in the language of your choice.
----------------------------------------------------------------
Thanks & Regards
Vikas, VCP70, MCTS on AD, SCJP6.0, VCF, vSphere with Tanzu specialist.
https://vThinkBeyondVM.com/about
-----------------------------------------------------------------
Disclaimer: Any views or opinions expressed here are strictly my own. I am solely responsible for all content published here. Content published here is not read, reviewed or approved in advance by VMware and does not necessarily represent or reflect the views or opinions of VMware.