Here is a little PS I wrote to create a volume, and add it to all VMware vSphere hosts attached to a particular vCenter instance:
Note, this must be run from the vSphere PowerCLI.
##########################################################
# Create-And-Add-Storage-example.ps1
# Jase McCarty 6/7/2010
# Posh Script to add a volume on a NetApp Filer
# and present it to all vSphere hosts
##########################################################
# Add the vSphere PowerCLI SnapIn and the DATA ONTAP Module
Import-module DataONTAP
# Set my variables
$vCenter = vcenter.domain.com
$Filer = filer.domain.com
$aggr = aggr1
$newvol = volx
# Connect to vCenter and our NetApp Filer
Connect-VIServer $vCenter
Connect-NaController $Filer
# Create a new volume
New-NaVol $newvol $aggr 500g
# Set some options for the new volume
Set-NaVolOption $newvol no_atime_update yes
Set-NaVolOption $newvol fractional_reserve 0
# Set the SnapShot Reserve to 0
Set-NaSnapshotreserve $newvol 0
Set-NaSnapshotschedule $newvol -Weeks 0 -Days 0 -Hours 0
# Add an NFS export
Add-NaNfsExport /vol/$newvol -Persistent -ReadWrite all-hosts -NoSuid -SecurityFlavors sys,krb5
# Get all the vSphere Hosts and add the NFS export
$Hosts = Get-VMHost
ForEach ($H in $Hosts) {
New-Datastore -Nfs -VMHost $_.Name -NAME $newvol -Path /vol/$newvol -NfsHost $Filer;
}
This is also detailed here: http://www.jasemccarty.com/blog/?p=831