My mistake, you should of course extract the device property.
Try it like this
$e01.storage.core.device.detached.list()|Select-ExpandPropertyDevice|
Select-First5|%{ $e01.storage.core.device.detached.remove($_) }$e01.storage.core.device.detached.list()|Select-ExpandPropertyDevice|
Select-Last5|%{ $e01.storage.core.device.detached.remove($_) }$e01.storage.core.device.detached.list()|Select-ExpandPropertyDevice|
Get-Random-Count5|%{ $e01.storage.core.device.detached.remove($_) }