VMware Cloud Community
desjardins
Contributor
Contributor
Jump to solution

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

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
Jump to solution

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
2 Replies
desjardins
Contributor
Contributor
Jump to solution

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

0 Kudos
JoergenKaare
Contributor
Contributor
Jump to solution

Hi, Could you please explain what this does?

0 Kudos