desjardins
Contributor
Contributor

how to Mount datastore (vVOL) to additional host using powerCLI

Jump to solution

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

0 Kudos
1 Solution

Accepted Solutions
desjardins
Contributor
Contributor

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 -----------------

View solution in original post

0 Kudos
1 Reply
desjardins
Contributor
Contributor

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 -----------------

View solution in original post

0 Kudos