Posted by: tonywilburn | March 1, 2014

Add NFS datastores to ESXi hosts with PowerCLI

This is such a quick and easy script I just had to share.  Others out there have versions of this script, but I had trouble finding one that would add a datastore to every host in a given cluster.  This works:

get-cluster <your_cluster>| get-vmhost | New-Datastore -NFS -Name <datastorename> -Path /<path to nfs mount point> -nfshost <hostname or IPaddress>

To add the datastore to every host in every cluster just remove the get-cluster

get-vmhost | New-Datastore -NFS -Name <datastorename> -Path /<path to nfs mount point> -nfshost <hostname or IPaddress>

Advertisements

Responses

  1. Cheers for script , saved me hours of adding datastores to lots of hosts in lots of clusters


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: