The value field is extracted from the returned object when the variable is set but the next line attempts to access .value.
This results in the test succeeding even when the EnableBlockDelete setting is turned off.
$enableblockdelete = ($esx | Get-AdvancedSetting -Name VMFS3.EnableBlockDelete).Value
if ($enableblockdelete .Value -eq 0)