• Step 1

Unmount the RDM disks from VM

  • Step 2

conncect-viserver 192.168.0.1

  • Step 3

Running following script with powershell

##Add function to Detach RDM LUN

function Detach-Disk { param( [VMware.VimAutomation.ViCore.Impl.V1.Inventory.VMHostImpl]$VMHost, [string]$CanonicalName )

$storSys = Get-View $VMHost.Extensiondata.ConfigManager.StorageSystem
$lunUuid = (Get-ScsiLun -VmHost $VMHost | where {$_.CanonicalName -eq $CanonicalName}).ExtensionData.Uuid

$storSys.DetachScsiLun($lunUuid)

}

##Detach LUNs from single host

$LunIDs = ("naa.6222257000032000406533030424344", "naa.6222257000032000406533030424345", "naa.6222257000032000406533030424346", "naa.6222257000032000406533030424347", "naa.6222257000032000406533030424348"

)

$VMHost = Get-vmhost "192.168.0.1"

Foreach($LUNid in $LunIDs) { Write-Host "Detaching" $LUNid "from" $VMHost -ForegroundColor "Yellow" Detach-Disk -VMHost $VMHost -CanonicalName $LUNid

}