Connect-VIServer myserver.fqdn.com
$VMHost = (Read-Host "Please enter the name of your the ESX Host you wish to configure")
$shellObject = new-object -comobject wscript.shell
$intAnswer = $shellObject.popup("Do you want to add the datastores?", 0,"Add datastores - remember you must have added the hosts on the storage",4)
If ($intAnswer -eq 6) {
Write "Creating Datastores on $VMHost…"
New-Datastore -Nfs -VMHost $VMHost -Name datastorename -Path /vol/volname -NfsHost 10.10.10.10
New-Datastore -Nfs -VMHost $VMHost -Name datastorename -Path /vol/volname -NfsHost 10.10.10.10
} else {
Write "Skipping Datastores on $VMHost…"
}