Monday, August 18, 2014

Add NFS storage to all VMware ESX / ESXi hosts using PowerCLI

Add NFS storage on VMware hosts

If you want to add a NFS volume on VMware to a lot of hosts, this is the perfect PowerCLI one-liner for you.  This will iterate through every host in vCenter and add the datastore - great for ISO datastores, etc.

On the VMware PowerCLI:

connect-viserver vcenter.domain.tld
Get-VMHost | New-Datastore -Nfs -Name volumename -Path "/vol/volumename" -NfsHost nfs-server-ip

For a read-only NFS datastore (great for ISOs), on the VMware PowerCLI:

connect-viserver vcenter.domain.tld
Get-VMHost | New-Datastore -Nfs -Name volumename -Path "/vol/volumename" -NfsHost nfs-server-ip -readonly

No comments:

Post a Comment

Featured Post

Remove 3D Objects and other annoying folders on Windows 10

 Microsoft just keeps adding more crap to clutter up the navigation in Windows 10.  Seriously, who needs a 3D Objects folder?  The tiny perc...