This PowerCLI snippet can be used to find all the BOSH VMs connected to a specific datastore and then disconnect the CD-ROM to avoid vMotion or SDRS errors.
- Open a PowerCLI session and login to the appropriate vCenter using the
Connect-VIServer
command.
- Copy the below eject-iso.ps1 snippet locally
- Change the datastore name, from
dsname
to whatever your datastore name is.
- Execute the script
The final output table will contain all the VMs processed and list out the updated ISOPaths which should be empty at this point.
NOTE The script only modifies BOSH VMs, i.e. those with mounted env.iso
files, however the output will display all VMs on the specified datastore and any other non-BOSH ISOs mounted.