VMware

Unmount ISO on VM using Rest API Vcenter 6.5

Has anyone had success unmounting an ISO on a VM using vcenter’s RestAPI? I keep getting error 415 unsupported media type.

I’m using the following:

[https://vdc-download.vmware.com/vmwb-repository/dcr-public/1cd28284-3b72-4885-9e31-d1c6d9e26686/71ef7304-a6c9-43b3-a3cd-868b2c236c81/doc/operations/com/vmware/vcenter/iso/image.unmount-operation.html](https://vdc-download.vmware.com/vmwb-repository/dcr-public/1cd28284-3b72-4885-9e31-d1c6d9e26686/71ef7304-a6c9-43b3-a3cd-868b2c236c81/doc/operations/com/vmware/vcenter/iso/image.unmount-operation.html)

​

code used:

* i already have a session created and i’m able to pull other info, just unable to trigger an unmount.

​

$body = ‘{“cdrom”:”16000″}’
Invoke-WebRequest -uri “https://$vcenter/rest/com/vmware/vcenter/iso/id:$($vm.vm)?~action=unmount” -Body $body -Headers $session -Method Post

i’ve tried several variations of the body format but nothing seems to work. thanks in advance.
The vms are windows 10


View Reddit by admoseleyView Source

Related Articles

One Comment

  1. What OS are you trying to unmount from? Linux OS’s cause a VM to pause until you answer the question in vCenter or on the host. Something to the effect of “the operating system has locked this ISO are sure you want to forcefully remove it?”

    Not sure if that is what is happening, but that hung me up with a PowerShell script previously. Not using Rest API, though.

Leave a Reply

Close