Hi there,
Need your help to refine the below script please. The requirement is to mount the replicated volumes on multiple ESXi host the DR site:
Not sure what does point# 2 and #3 does and also, how and where do I use ForEach-Object loop in the script.
Thanks in advance
Mounting Replicated VMFS Volumes
Following the successful use of the storage management utility to break replication and make volumes
read/write (if required by the storage platform), virtual machines appear inactive in the vCenter Server
inventory. To rectify this, replicated VMFS volumes must be force mounted by the recovery hosts.
NOTE: It is essential that this process be conducted with caution to ensure that the mount process does not
result in volumes’ being resignatured. It is critical to the success of the approach described in this technical
paper that no MoRef or UUID changes occur. In addition, the process illustrated assumes that VMFS volumes
comprise a single extent.
Follow these steps to mount replicated VMFS volumes using vSphere PowerCLI:
1.Connect to the vCenter Server managing the resource cluster and initiate an HBA rescan on all
ESXi servers.
Get-Cluster Name | Get-VMHost | Get-VMHostStorage -RescanAllHba
2.Connect to an ESXi server and identify unresolved VMFS volumes arising from a UUID conflict.
$VMHost = Get-VMHost
$HstSys = Get-View $VMHost.id
$HstDsSys = Get-View $HstSys.ConfigManager.DatastoreSystem
$UnresVols = $HstDsSys.QueryUnresolvedVmfsVolumes()
3.Resolve the UUID conflict on the discovered VMFS volume(s) on the ESXi server.
$HstSSys = Get-view $VMHost.StorageInfo
$UnresVol = $UnresVols[Array Index]
$Extent = $UnresVol.Extent
$DevicePath = $UnresVol.Extent.DevicePath
$ResSpec = New-Object Vmware.Vim.HostUnresolvedVmfsResolutionSpec[](1)
$ResSpec[0].ExtentDevicePath = $DevicePath
$ResSpec[0].UuidResolution = “forceMount”
$HstSSys.ResolveMultipleUnresolvedVmfsVolumes($ResSpec)
4.Initiate a VMFS rescan on the ESXi servers.
$VMHost | Get-VMHostStorage -RescanVmfs
5.Repeat steps 3 and 4 for each of the unresolved VMFS volumes on each affected ESXi server within the
cluster. This should be performed using a direct connection to the associated ESXi server (as opposed to
vCenter Server).
NOTE: When a requirement exists to perform an action on multiple array objects, such as the unresolved VMFS
volumes, it is advisable to use a cmdlet such as ForEach-Object.