Caution: Articles written for technical not grammatical accuracy, If poor grammar offends you proceed with caution ;-)
This simple little useful script can be used to add a new nfs datastore to all the hosts in an esx cluster. Alternatively you can modify this and replace get-cluster CLUSTER_NAME with get-datacenter DATACENTER_NAME and add an ISO nfs share to your whole datacenter.
foreach ($ESXhost in get-cluster CLUSTER_NAME| get-vmhost)
New-datastore –nfs –vmhost $ESXhost –name [datastore_name] –path [/remote_path] –nfshost [nfs_server]
Simply replace CLUSTER_NAME with the name of the cluster you would like to run the script against, replace datastore_name with the name you want the datastore to have, replace remote_path with the nfs path on the nfs server, and nfs_server with the hostname or IP address of the nfs server you are connecting to.
New-datastore –nfs –vmhost (get-cluster “cluster_name” | get-vmhost) –name [datastore_name] –path[/remote_path] –nfshost [nfs_server]
One Reply to “VI Toolkit powershell simple script #2 – Create new NFS datastore”