/ Published in: Windows PowerShell
Assumes the targets are already visible in the storage adapter, and you just want to create the VMFS volume
Expand |
Embed | Plain Text
function New-DatastoreByLun { param($vmHost, [string]$hbaId, [int]$targetId, [int]$lunId, [string]$dataStoreName) $lun = $view.Config.StorageDevice.ScsiTopology | ForEach-Object { $_\3.Adapter } | Where-Object {$_\3.Key -match $hbaId} | ForEach-Object {$_\3.Target} | Where-Object {$_\3.Target -eq $targetId} | ForEach-Object {$_\3.Lun} | Where-Object {$_\3.Lun -eq $lunId} $scsiLun = Get-VMHost $vmHost | Get-ScsiLun | Where-Object {$_\3.Key -eq $lun.ScsiLun} New-Datastore -Name $dataStoreName -Path $scsiLun.CanonicalName -Vmfs }
You need to login to post a comment.
