Mware articles outlining the correct procedure for removing datastores in a vSphere environment:
$vcServer = "vCenter01"
$cluster = "CL01"
$esxCred = Get-Credential
Connect-VIServer $vcServer | Out-Null
#Connect to ESX hosts in cluster
foreach ($esx in Get-Cluster $cluster | Get-VMHost) {
Connect-VIServer $esx -Credential $esxCred | Out-Null
Get-VMHostAdvancedConfiguration -Name "ScratchConfig.ConfiguredScratchLocation"
}