i am using this commande to attach new host to existant datastore vVOL : but is not working
$esxi | new-Datastore -Name $vVol.Name
any help will be appreciate
i found the solution!!!
$vVol=Get-Cluster -name $Cluster | Get-Datastore |Where-Object{$_.name -like "*vvol*" }
$EsxiID=$esxi| select ID
$CodeHost=$EsxiID.id.substring($EsxiID.id.length -6, 6) #get code Host
$DatastoreSystemID="HostDatastoreSystem-datastoreSystem-"+$CodeHost
#---------------attachVvolDatastore---------------
$URL=$vVol|select ExtensionData $ScId=(($URL.ExtensionData.info.url).Replace("/","")).Replace("ds:vmfsvolumes","") $spec = New-Object VMware.Vim.HostDatastoreSystemVvolDatastoreSpec $spec.Name = $vVol.Name $spec.ScId = $ScId $_this = Get-View -Id $DatastoreSystemID $_add=$_this.CreateVvolDatastore($spec)
#----------------- End of code capture -----------------
i found the solution!!!
$vVol=Get-Cluster -name $Cluster | Get-Datastore |Where-Object{$_.name -like "*vvol*" }
$EsxiID=$esxi| select ID
$CodeHost=$EsxiID.id.substring($EsxiID.id.length -6, 6) #get code Host
$DatastoreSystemID="HostDatastoreSystem-datastoreSystem-"+$CodeHost
#---------------attachVvolDatastore---------------
$URL=$vVol|select ExtensionData $ScId=(($URL.ExtensionData.info.url).Replace("/","")).Replace("ds:vmfsvolumes","") $spec = New-Object VMware.Vim.HostDatastoreSystemVvolDatastoreSpec $spec.Name = $vVol.Name $spec.ScId = $ScId $_this = Get-View -Id $DatastoreSystemID $_add=$_this.CreateVvolDatastore($spec)
#----------------- End of code capture -----------------
Hi, Could you please explain what this does?