LucD,
Can we check first if the CD rom really mounted ? local storage i mean that if the VM is in local storage then it might fail.
PS C:\temp>
PS C:\temp> Get-VM cbv | Get-CDDrive | Set-CDDrive -NoMedia -Confirm:$False
Set-CDDrive : 12/31/2018 5:14:05 AM Set-CDDrive Server task failed: The operation is not allowed in the
current state
of the host.
At line:1 char:40
+ ... cbv-cscddsview1 | Get-CDDrive | Set-CDDrive -NoMedia -Confirm:$False
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Set-CDDrive], VimException
+ FullyQualifiedErrorId : Security_Impl_TaskResultConverter_TaskNotSucceeded,VMware.VimAutomation.ViCore.Cmdlets.C
ommands.VirtualDevice.SetCDDrive